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

:root {
  --primary: #26ecb2;
  --primary-dark: #1fc99a;
  --secondary: #1fc99a;
  --bg-dark: #000000;
  --bg-card: #0a0a0a;
  --bg-input: #1a1a1a;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #333333;
  --success: #22c55e;
  --error: #ef4444;
  --sidebar-width: 0px;
  --gradient-main: linear-gradient(to bottom, #26ecb2, #1fc99a);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(ellipse 120% 80% at 0% 60%, rgba(38, 236, 178, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 100% 10%, rgba(38, 236, 178, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse 60% 80% at 50% 100%, rgba(38, 236, 178, 0.04) 0%, transparent 60%),
    #040e0b;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, #0a0a0a 0%, #000000 100%);
  border-right: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  background: var(--primary);
}

.sidebar-logo {
  margin-bottom: 2rem;
}

.sidebar-logo svg {
  filter: drop-shadow(0 4px 12px rgba(38, 236, 178, 0.4));
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.nav-btn .mdi {
  font-size: 26px;
  line-height: 1;
}

.nav-btn:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: var(--primary);
  background: rgba(38, 236, 178, 0.15);
}

.nav-btn svg {
  width: 26px;
  height: 26px;
}

.sidebar-footer {
  margin-top: auto;
}

/* Sidebar hidden — replaced by top nav */
.sidebar {
  display: none !important;
}

/* ===== Top Navigation Header ===== */
.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-logo svg {
  display: block;
  filter: drop-shadow(0 2px 8px rgba(38, 236, 178, 0.45));
}

.header-logo img {
  display: block;
  height: 36px;
  width: auto;
  object-fit: contain;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.top-nav-btn {
  padding: 0.5rem 1.35rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.62);
  font-family: "Scada", sans-serif;
  font-size: 1.2rem;
  font-weight: 400;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: color 0.15s, background 0.15s;
}

.top-nav-btn:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.04);
}

.top-nav-btn.active {
  color: #ffffff;
  background: transparent;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Settings icon button in header */
.settings-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.65);
  font-family: "Scada", sans-serif;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.settings-icon-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(38, 236, 178, 0.08);
}

.settings-icon-btn.active {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(38, 236, 178, 0.12);
}

.settings-icon-btn .mdi {
  font-size: 20px;
  line-height: 1;
}

/* ===== Create World FAB ===== */
.create-world-fab {
  position: fixed;
  top: 88px;
  right: 2rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.6rem;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 40;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.create-world-fab:hover {
  transform: translateY(-2px);
  background: rgba(18, 18, 18, 0.85);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.create-world-fab.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem 3rem;
  overflow-y: auto;
  max-height: 100vh;
  position: relative;
}

/* Liquid glass sheen over main content area */
.main-content::before {
  content: '';
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background:
    linear-gradient(135deg, rgba(38,236,178,0.025) 0%, transparent 45%),
    linear-gradient(225deg, rgba(38,236,178,0.015) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.panel {
  max-width: 800px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

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

.panel-header {
  margin-bottom: 2rem;
  text-align: center;
}

.panel-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.panel-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Creation Card */
.world-name-input {
  width: 100%;
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.25) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0.25rem 0;
  font-family: "Scada", sans-serif !important;
  font-size: 1.6rem !important;
  font-weight: 700;
  color: #ffffff;
  outline: none;
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
  transition: border-color 0.2s;
}

.world-name-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
  font-size: 1.6rem;
  font-family: "Scada", sans-serif;
}

.world-name-input:focus {
  border-bottom-color: rgba(255, 255, 255, 0.6) !important;
}

.creation-card {
  background: transparent;
  border-radius: 22px;
  padding: 1.5rem;
  box-shadow: none;
  position: relative;
  border: none;
}

.creation-card::before {
  display: none;
}

/* Tabs */
.input-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: rgba(38, 236, 178, 0.1);
  border-color: var(--primary);
  color: var(--text-primary);
}

.tab-btn.active {
  background: rgba(38, 236, 178, 0.2);
  border-color: var(--primary);
  color: var(--text-primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Input Groups */
.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.input-group textarea,
.input-group input[type="text"],
.input-group input[type="password"] {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  transition: border-color 0.2s ease;
}

.input-group textarea:focus,
.input-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.input-group textarea::placeholder,
.input-group input::placeholder {
  color: var(--text-muted);
}

.input-group small {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
  position: relative;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.05);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-placeholder svg {
  color: var(--text-muted);
}

.upload-placeholder p {
  color: var(--text-secondary);
  font-weight: 500;
}

.upload-placeholder span {
  color: var(--text-muted);
  font-size: 0.875rem;
}

#upload-preview {
  position: absolute;
  inset: 1rem;
}

#upload-preview img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.remove-image {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--error);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.remove-image:hover {
  transform: scale(1.1);
}

/* Step Sections (new world workflow) */
.step-section {
  margin-bottom: 1.5rem;
}

.step-section:last-child {
  margin-bottom: 0;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

/* Image Actions (generate + upload buttons) */
.image-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
}

.action-btn.primary {
  background: rgba(38, 236, 178, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

.action-btn.primary:hover {
  background: rgba(38, 236, 178, 0.25);
}

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

.action-btn.secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-secondary);
}

.or-divider {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* Image Preview Zone */
.image-preview-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.image-preview-zone.has-image {
  border-style: solid;
  border-color: var(--primary);
}

.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem;
  text-align: center;
}

.preview-placeholder svg {
  color: var(--text-muted);
}

.preview-placeholder p {
  color: var(--text-secondary);
  font-weight: 500;
  margin: 0;
}

.preview-placeholder span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.preview-image-wrapper {
  position: relative;
  display: inline-block;
  padding: 0.5rem;
}

.preview-image-wrapper img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
}

/* Options */
.options-row {
  display: flex;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.checkbox-label input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* Generate Button */
.generate-btn-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.generate-btn {
  width: auto;
  padding: 0.75rem 2rem;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  color: #000;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(38, 236, 178, 0.3);
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(38, 236, 178, 0.4);
}

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

/* Panel Sub-tabs */
.panel-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.panel-tab {
  padding: 0.65rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: -1px;
}

.panel-tab:hover {
  color: var(--text-primary);
}

.panel-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.panel-tab-content {
  display: none;
}

.panel-tab-content.active {
  display: block;
}

/* Status Card */
.status-card {
  margin-top: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.status-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.status-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#status-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.progress-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-main);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Viewer Container */
.viewer-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16/9;
  position: relative;
}

.viewer-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
}

.viewer-placeholder p {
  font-weight: 500;
}

.viewer-placeholder span {
  font-size: 0.875rem;
}

#world-canvas {
  width: 100%;
  height: 100%;
  display: none;
}

#world-canvas.active {
  display: block;
}

/* Worlds Grid */
.worlds-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 0 0.25rem;
}

.worlds-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  text-align: center;
}

.worlds-empty p {
  font-weight: 500;
  margin-top: 0.5rem;
}

.worlds-empty span {
  font-size: 0.875rem;
}

/* ── World Card: thumbnail fills entire card, glass bottom ── */
.world-card {
  border: none;
  border-radius: 22px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 1 / 1;
  background: #052622;
}

/* outer glow border sheen */
.world-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  pointer-events: none;
  z-index: 2;
}

.world-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(38, 236, 178, 0.25);
}

/* Thumbnail fills the whole card as background */
.world-card-thumb {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.world-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.world-card:hover .world-card-thumb img {
  transform: scale(1.06);
}

/* Generic img fallback (library cards use <img> directly) */
.world-card > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transition: transform 0.5s ease;
}

.world-card:hover > img {
  transform: scale(1.06);
}

/* Glass bottom panel — sits above the thumbnail */
.world-card-glass-bottom {
  position: relative;
  z-index: 1;
  margin-top: auto;
  height: 25%;
  box-sizing: border-box;
  overflow: hidden;
  background: rgba(10, 10, 18, 0.45);
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.world-card-info {
  padding: 6px 10px 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.world-card-info h3 {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Owner row: label left, address right */
.world-owner-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.65);
  font-family: monospace;
}
.world-owner-row .owner-label {
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
  font-family: inherit;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.6rem;
}
.world-owner-row .owner-address {
  color: rgba(255, 255, 255, 0.75);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-card-info span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.rename-input {
  width: 100%;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-primary);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  outline: none;
  box-sizing: border-box;
}

/* Generating / failed cards */
.world-card.generating,
.world-card.failed {
  cursor: default;
}

.world-card.generating:hover,
.world-card.failed:hover {
  transform: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.generating-placeholder {
  flex: 1;
  background: linear-gradient(135deg, rgba(5, 38, 34, 0.85) 0%, rgba(2, 15, 12, 0.95) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
}

.generating-placeholder.failed {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, var(--bg-card) 100%);
  color: #ef4444;
}

.generating-placeholder span {
  font-size: 0.875rem;
  font-weight: 500;
}

.generating-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.status-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.status-badge.generating {
  background: rgba(38, 236, 178, 0.15);
  color: var(--primary);
  animation: pulse 2s ease-in-out infinite;
}

.status-badge.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.status-badge.step-mint {
  background: rgba(251, 191, 36, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.status-badge.step-link {
  background: rgba(124, 58, 237, 0.15);
  color: #8b5cf6;
  border: 1px solid rgba(124, 58, 237, 0.25);
}

/* Step action button row at bottom of world card */
.card-action-row {
  padding: 0 10px 10px;
  display: flex;
  gap: 0.5rem;
}

.card-action-btn {
  flex: none;
  width: auto;
  padding: 0.28rem 15px;
  border: none;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.card-action-btn:active { transform: scale(0.97); }
.card-action-btn:hover  { opacity: 0.85; }

/* Marketplace card-action-row: price left, buy button right, aligned at bottom */
#panel-market .card-action-row {
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 10px 8px;
  gap: 0.5rem;
}

#panel-market .card-action-row .market-price-label {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

#panel-market .card-action-row .market-price-label .price-unit {
  font-size: 0.55rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#panel-market .card-action-row .market-price-label .price-value {
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 700;
  line-height: 1;
}

/* Buy button in marketplace — liquid glass */
.buy-world-btn {
  flex: 0 0 60px;
  width: 60px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.28rem 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.buy-world-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
}

.world-link-btn {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.world-link-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.refresh-btn,
.save-btn {
  padding: 0.75rem 1.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-btn:hover,
.save-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* Settings Card */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

.settings-info {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.settings-info svg {
  color: #10b981;
  flex-shrink: 0;
  margin-top: 2px;
}

.settings-info h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  color: var(--text-primary);
}

.settings-info p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.settings-info code {
  background: rgba(139, 92, 246, 0.2);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* ── Hamburger button (hidden on desktop) ── */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mobile-menu-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
/* Animate to X when menu is open */
.mobile-menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile nav dropdown ── */
.top-nav.mobile-open {
  display: flex !important;
}

/* ── Top-up button: show label on desktop, icon on mobile ── */
.topup-icon { display: none; }
.topup-label { display: inline; }

/* Responsive */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  /* Show hamburger */
  .mobile-menu-btn {
    display: flex;
  }

  /* ── Header ── */
  .top-header {
    height: 56px;
    padding: 0 0.5rem;
    gap: 0.4rem;
  }
  .header-logo {
    display: none;
  }
  .header-left {
    gap: 0.5rem;
  }

  /* Hide horizontal nav, show as dropdown */
  .top-nav {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(8, 8, 8, 0.97);
    backdrop-filter: blur(16px);
    padding: 0.5rem 0;
    z-index: 200;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .top-nav-btn {
    width: 100%;
    text-align: left;
    padding: 0.85rem 1.25rem;
    font-size: 1.1rem;
    border-radius: 0;
  }
  .top-nav-btn.active {
    background: rgba(38, 236, 178, 0.08);
    color: var(--primary);
  }

  /* ── Header-right: balance + wallet compact ── */
  .header-right {
    gap: 0.35rem;
  }
  .wallet-info {
    gap: 0.3rem;
  }
  /* Balance: 50% of desktop size */
  .moltbux-plain {
    font-size: 0.55rem;
    gap: 0.15rem;
  }
  /* Show locked balance but compact */
  .moltbux-locked-group {
    opacity: 0.5;
  }
  /* Top-up: arrow icon only */
  .topup-plain-btn {
    padding: 0.2rem 0.35rem;
    font-size: 0.8rem;
    line-height: 1;
  }
  .topup-label { display: none; }
  .topup-icon { display: inline; }
  /* Wallet button: icon only, tighter */
  .wallet-btn {
    padding: 0.35rem;
    min-width: unset;
    gap: 0;
  }
  .wallet-btn #wallet-btn-text {
    display: none;
  }
  .wallet-btn svg {
    width: 16px;
    height: 16px;
  }

  .nav-btn span {
    display: none;
  }

  /* ── Main content ── */
  .main-content {
    padding: 0.75rem 0.5rem;
    margin-top: 56px;
  }

  /* ── World cards grid: single column ── */
  .worlds-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0;
  }
  .world-card {
    width: 100%;
    aspect-ratio: 4 / 3;
  }
  .world-card-glass-bottom {
    height: 40%;
    overflow: visible;
  }
  .card-action-row {
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0 8px 8px;
  }
  .card-action-btn {
    padding: 0.28rem 10px;
    font-size: 0.62rem;
  }

  /* ── Marketplace ── */
  #panel-market .worlds-grid {
    grid-template-columns: 1fr;
  }
  .market-grid {
    grid-template-columns: 1fr;
    padding: 0.75rem;
  }
  .market-card-info h3 {
    white-space: normal;
  }
  #panel-market .card-action-row {
    flex-wrap: wrap;
  }
  .buy-world-btn {
    flex: 0 0 auto;
    width: auto;
    padding: 0.28rem 12px;
  }

  /* ── Card sell row ── */
  .card-sell-row {
    padding: 0 0.5rem 0.5rem;
  }

  /* ── Build form ── */
  .creation-card {
    padding: 0.75rem;
  }
  .upload-zone {
    height: 140px;
  }
  .generate-btn-wrapper {
    margin-top: 1rem;
    padding-bottom: 1rem;
  }
  .generate-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  .fee-info {
    padding: 0.5rem;
  }

  /* ── Map panel: shorter header ── */
  .panel.panel-map {
    top: 56px;
    height: calc(100vh - 56px);
  }

  .options-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  /* Builder cards: stack vertically */
  .builder-cards {
    flex-direction: column;
  }
}

/* ==================== Graph / Map Panel ==================== */

.panel.panel-map {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: calc(100vh - 72px);
  z-index: 40;
  padding: 0;
  margin: 0;
  max-width: none;
  overflow: hidden;
  animation: none; /* no slide-in for fullscreen canvas */
}

/* Link mode top bar — floats above canvas, offset past sidebar */
.graph-header {
  position: absolute;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 60;
}

.link-mode-bar {
  display: none;
  align-items: center;
  gap: 1.5rem;
  background: rgba(38, 236, 178, 0.06);
  border-bottom: 1px solid rgba(38, 236, 178, 0.25);
  padding: 0.75rem 1.5rem;
  flex-wrap: wrap;
}

.link-mode-bar.active {
  display: flex;
}

.link-mode-world-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1.5px solid var(--primary);
  border-radius: 10px;
  padding: 0.4rem 1rem 0.4rem 0.5rem;
}

.link-mode-world-card img {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
}

.link-mode-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.link-mode-label {
  font-size: 0.65rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

.link-mode-info strong {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.link-mode-cancel {
  margin-left: auto;
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.link-mode-cancel:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.link-mode-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.hint-plus {
  color: var(--primary);
  font-weight: 700;
}

/* Graph canvas — fills visible area (right of sidebar) */
.graph-container {
  position: absolute;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  overflow: hidden;
  /* Liquid glass — same family as marketplace/panels */
  background:
    linear-gradient(135deg, rgba(38, 236, 178, 0.03) 0%, transparent 50%),
    linear-gradient(225deg, rgba(38, 236, 178, 0.02) 0%, transparent 60%),
    rgba(8, 10, 12, 0.92);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}

/* Subtle top-left glass sheen */
.graph-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0%,
    transparent 40%,
    rgba(38, 236, 178, 0.02) 100%
  );
  pointer-events: none;
  z-index: 0;
}

.map-zoom-controls {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 10;
}

.map-zoom-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(38, 236, 178, 0.4);
  background: rgba(0, 0, 0, 0.75);
  color: #26ecb2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  backdrop-filter: blur(6px);
}

.map-zoom-btn:hover {
  background: rgba(38, 236, 178, 0.15);
  border-color: #26ecb2;
}

.map-zoom-btn .mdi {
  font-size: 20px;
}

/* ── Liquid Glass overlay panel (bottom-left of map) ─────────────────────── */
@keyframes glassEntrance {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    backdrop-filter: blur(0px) saturate(100%);
    -webkit-backdrop-filter: blur(0px) saturate(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
  }
}

.map-glass-panel {
  position: absolute;
  bottom: 5rem;
  left: calc(var(--sidebar-width) + 20px);
  width: 270px;
  background: rgba(5, 38, 34, 0.52);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(38, 236, 178, 0.18);
  border-radius: 22px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 5;
  animation: glassEntrance 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Subtle light sheen at top via pseudo-element */
.map-glass-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.06) 0%,
    transparent 55%,
    rgba(38, 236, 178, 0.04) 100%
  );
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
}

.map-glass-header {
  position: relative;
  z-index: 1;
  padding: 12px 16px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.map-glass-header .mdi {
  font-size: 14px;
  color: var(--primary);
}

.map-glass-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.map-glass-subtitle {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  margin-left: auto;
}

.map-mini-wrap {
  position: relative;
  z-index: 1;
  padding: 10px 10px 12px;
}

#world-graph-mini {
  display: block;
  width: 100%;
  height: 170px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.45);
}

#world-graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Card controls: public toggle + rename */
.card-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.toggle-public {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  width: 28px;
  height: 16px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 16px;
  transition: background 0.2s;
  cursor: pointer;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

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

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(12px);
}

.rename-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  line-height: 0;
  transition: color 0.2s;
  flex-shrink: 0;
}

.rename-btn:hover {
  color: var(--primary);
}

/* Link button on world cards */
.world-card-footer {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid rgba(38, 236, 178, 0.15);
}

/* Explore Panel (Fullscreen 3D Viewer) */
.explore-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  /* Prevent text selection / blue highlight on click/drag */
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.explore-panel.active {
  opacity: 1;
  visibility: visible;
}

.explore-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.explore-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Edit World button — shown in explore panel for owned worlds */
.explore-edit-btn {
  position: absolute;
  top: 1.5rem;
  right: calc(1.5rem + 48px + 12px); /* next to the close button */
  height: 40px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 179, 237, 0.75);
  border: 1px solid rgba(99, 179, 237, 0.9);
  border-radius: 20px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.explore-edit-btn:hover {
  background: rgba(99, 179, 237, 0.9);
  border-color: #63b3ed;
  color: #fff;
  transform: scale(1.04);
}

.explore-edit-btn.active {
  background: rgba(220, 80, 80, 0.85);
  border-color: rgba(240, 100, 100, 0.9);
  color: #fff;
}

.explore-edit-btn.active:hover {
  background: rgba(220, 80, 80, 1.0);
  border-color: #f06464;
  transform: scale(1.04);
}

/* Edit button on world cards (Build panel) */
.card-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(99, 179, 237, 0.12);
  border: 1px solid rgba(99, 179, 237, 0.3);
  border-radius: 6px;
  color: #90cdf4;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.card-edit-btn:hover {
  background: rgba(99, 179, 237, 0.25);
  border-color: rgba(99, 179, 237, 0.6);
  color: #fff;
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(72, 187, 120, 0.12);
  border: 1px solid rgba(72, 187, 120, 0.3);
  border-radius: 6px;
  color: #9ae6b4;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.download-btn:hover {
  background: rgba(72, 187, 120, 0.25);
  border-color: rgba(72, 187, 120, 0.6);
  color: #fff;
}

#explore-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Loading overlay */
.explore-loading {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: opacity 0.3s ease;
}

.explore-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.explore-loading-content {
  text-align: center;
  color: white;
}

.explore-loading-content h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.explore-progress-bar {
  width: 300px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.explore-progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.2s ease;
}

.explore-loading-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* NFT Info overlay in explore panel */
.explore-nft-info {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 24px;
  padding: 0.5rem 1rem;
  z-index: 10;
}

.explore-nft-info.hidden {
  display: none;
}

.explore-nft-badge {
  color: #10b981;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.explore-nft-address {
  color: var(--primary);
  font-family: monospace;
  font-size: 0.8rem;
  text-decoration: none;
  opacity: 0.9;
}

.explore-nft-address:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Minted badge in world cards (sidebar) */
.minted-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.world-earned {
  display: inline-block;
  background: rgba(251, 191, 36, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 12px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-top: 0.25rem;
}

/* ===== Build panel — new builder selection layout ===== */

.build-header {
  display: none; /* replaced by market-header style */
}

/* Generic reusable section header (same style as marketplace header) */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
}

.section-header-title {
  font-family: "Scada", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: 0.03em;
}

.section-header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.section-header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.build-mascot {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
}

.builder-selection {
  padding: 1rem 1.25rem;
}

.builder-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.builder-card {
  background: #052622;
  border: none;
  border-radius: 22px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  aspect-ratio: 1 / 1;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
  text-align: center;
}

.builder-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  pointer-events: none;
  z-index: 2;
}

.builder-card:not(:disabled):hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(38, 236, 178, 0.25);
}

.builder-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.builder-card-img-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #052622;
}

.builder-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.builder-coming-soon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

.builder-card-label {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(26, 26, 26, 0.82);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 1;
}

/* World Labs form back header */

.worldlabs-form-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 15px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 0.15s, color 0.15s;
}

.back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* My Games panel header */

#panel-mygames .panel-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

/* ==================== Marketplace ==================== */

/* Sub-tabs */
/* Market header with history toggle */
.market-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.25rem;
}

.market-panel-title {
  font-family: "Scada", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: 0.03em;
}

.market-history-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.market-history-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Locks panel header - matching marketplace header design */
.locks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.75rem;
}

.locks-panel-title {
  font-family: "Scada", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: 0.03em;
}

.locks-total {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

#panel-market .worlds-grid {
  margin-top: 1rem;
}

/* For Sale grid */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  overflow-y: auto;
}
.market-loading,
.market-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 0;
  font-size: 0.875rem;
}

/* Market card */
.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.market-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.market-card-thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-secondary);
}
.market-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.market-card-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}
.market-card-info {
  padding: 0.75rem 0.875rem 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.market-card-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.market-owner {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.market-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}
/* buy-world-btn override cleared — base rule handles sizing */

/* Transactions list */
.transactions-list {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}
.tx-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.tx-world {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.tx-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.tx-amount {
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Sell / On Sale buttons on world cards */
.card-sell-row {
  padding: 0 0.75rem 0.75rem;
}

/* My Games panel: solid grey bottom strip instead of glassmorphic */
#panel-mygames .world-card-glass-bottom {
  background: rgba(20, 20, 28, 0.92);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.sell-btn,
.onsale-btn {
  flex: 0 0 auto;
  width: auto;
  margin-left: auto;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.sell-btn {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.sell-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
}
.onsale-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.65);
}
.onsale-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Extracted inline styles ───────────────────────────────── */

/* App toast notification */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,30,0.92);
  color: #fff;
  font: 14px sans-serif;
  padding: 10px 20px;
  border-radius: 24px;
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.3s ease;
  border: 1px solid rgba(255,255,255,0.15);
}

/* Lock card in locks panel */
.lock-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lock-card-right {
  text-align: right;
}

/* Explorer: camera-mode toast */
.explore-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  font: 13px monospace;
  padding: 6px 14px;
  border-radius: 4px;
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.4s;
}

/* Explorer: mobile joystick */
.explore-joystick {
  position: fixed;
  bottom: 80px;
  left: 40px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  display: none;
  z-index: 1001;
  touch-action: none;
}
.explore-joystick-knob {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Explorer: tap-to-teleport hint */
.explore-hint {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 12px;
  border-radius: 4px;
  display: none;
  z-index: 1001;
}

/* Explorer: collider debug HUD */
.explore-debug-hud {
  position: fixed;
  top: 60px;
  left: 10px;
  z-index: 9999;
  background: rgba(0,0,0,0.7);
  color: #0ff;
  font: 12px monospace;
  padding: 8px 12px;
  border-radius: 4px;
  pointer-events: none;
  white-space: pre;
  line-height: 1.6;
}

/* Explorer: portal modal overlay */
.portal-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.60);
  backdrop-filter: blur(10px);
  z-index: 9999;
}

/* Explorer: portal proximity hint pill */
.portal-hint-pill {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  font-family: sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 30px;
  pointer-events: none;
  z-index: 50;
  letter-spacing: 0.02em;
  text-shadow: 0 0 8px rgba(180,180,255,0.8);
  transition: opacity 0.25s ease;
  opacity: 0;
  white-space: nowrap;
}
