.detail-page {
  overflow-x: hidden;
  background: #fff;
}

.detail-wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 20px 32px 48px;
}

.model-loading,
.model-not-found {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-secondary);
}

.model-not-found-hint {
  margin: 12px 0 20px;
  font-size: 14px;
  color: var(--text-muted);
}

.model-not-found code {
  padding: 2px 8px;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 13px;
}

.btn-not-found,
.model-not-found a {
  display: inline-block;
  padding: 10px 20px;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border-radius: var(--radius-sm);
}

.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.detail-breadcrumb a:hover {
  color: var(--primary);
}

.detail-layout-3ddd {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}

.detail-main-col {
  min-width: 0;
}

.gallery-3ddd {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 12px;
  align-items: stretch;
}

.gallery-thumbs-v {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 88px;
  flex-shrink: 0;
}

.gallery-thumb-v {
  width: 88px;
  height: 88px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.55;
  background: var(--surface-2);
  transition: opacity 0.15s, border-color 0.15s;
}

.gallery-thumb-v img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb-v.active,
.gallery-thumb-v:hover {
  opacity: 1;
  border-color: var(--primary);
}

.gallery-viewport {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 0;
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
}

.gallery-viewport img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 56px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-secondary);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s, color 0.15s;
}

.gallery-nav:hover {
  background: #fff;
  color: var(--text);
}

.gallery-nav-prev {
  left: 12px;
  border-radius: 8px 0 0 8px;
}

.gallery-nav-next {
  right: 12px;
  border-radius: 0 8px 8px 0;
}

.recommend-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.recommend-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.recommend-btn.active,
.recommend-btn:hover {
  background: var(--primary-light);
  border-color: rgba(56, 110, 68, 0.25);
  color: var(--primary);
}

.model-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 24px;
  box-shadow: none;
}

.sidebar-author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.sidebar-author img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.sidebar-author-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.sidebar-author-name:hover {
  color: var(--primary);
}

.sidebar-author-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.model-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
  color: var(--accent-black, #030303);
}

.model-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-black, #030303);
}

.model-price-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.model-royalty {
  font-size: 12px;
  color: var(--text-muted);
}

.model-actions-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-cart,
.btn-fav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-cart {
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid rgba(56, 110, 68, 0.2);
  border-radius: 0;
}

.btn-cart:hover {
  background: #dce8de;
}

.btn-fav-count {
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 64px;
  border-radius: 0;
}

.btn-fav-count.active,
.btn-fav-count:hover {
  color: #ef4444;
  border-color: #fecaca;
  background: #fff5f5;
}

.btn-buy-main,
.btn-download-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: white;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-buy-main {
  background: var(--accent-black, #030303);
}

.btn-buy-main:hover {
  background: var(--primary);
}

.btn-download-main {
  background: var(--primary);
}

.btn-download-main:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-download-main:disabled {
  opacity: 0.7;
  cursor: wait;
}

.pro-balance-note {
  margin-top: 10px;
  margin-bottom: 18px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.specs-table {
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

.spec-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.spec-row:last-child {
  border-bottom: none;
}

.spec-row dt {
  color: var(--text-muted);
}

.spec-row dd {
  font-weight: 600;
  color: var(--text);
}

.publish-date {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.detail-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 28px;
}

.model-comments,
.model-desc-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.model-comments h2,
.model-desc-block h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.comment-form {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.comment-form img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.comment-form input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.comment-item {
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.comment-item img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.comment-head strong {
  font-size: 14px;
}

.comment-head span {
  font-size: 12px;
  color: var(--text-muted);
}

.comment-item p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.model-desc-block p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.desc-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.desc-list {
  margin: 12px 0;
  padding-left: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag-list .tag {
  padding: 5px 12px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-pill);
}

.related-block {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.related-block h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

@media (max-width: 1200px) {
  .detail-layout-3ddd {
    grid-template-columns: 1fr 300px;
  }

  .detail-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .detail-wrap {
    padding: 12px 16px 32px;
  }

  .detail-layout-3ddd {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .model-sidebar {
    position: static;
    order: 2;
  }

  .detail-main-col {
    order: 1;
  }

  .gallery-3ddd {
    flex-direction: column;
    min-height: auto;
    padding: 10px;
  }

  .gallery-thumbs-v {
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .gallery-thumb-v {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
  }

  .gallery-thumbs-v {
    width: auto;
  }

  .gallery-viewport {
    aspect-ratio: 1;
    min-height: 0;
  }

  .gallery-viewport img {
    max-height: 280px;
  }

  .gallery-nav {
    width: 32px;
    height: 44px;
    font-size: 22px;
  }

  .model-title {
    font-size: 18px;
  }

  .model-price {
    font-size: 20px;
  }

  .spec-row {
    grid-template-columns: 90px 1fr;
    gap: 8px;
    font-size: 12px;
  }

  .detail-bottom-grid {
    gap: 16px;
    margin-top: 16px;
  }

  .model-comments,
  .model-desc-block {
    padding: 16px;
  }

  .related-block .model-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .model-actions-row {
    grid-template-columns: 1fr;
  }

  .related-block .model-grid {
    grid-template-columns: 1fr;
  }
}

/* Inline image editor (editor user) */
.model-image-editor {
  margin-top: 16px;
}

.model-image-editor-inner {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 20px;
}

.model-image-editor-head h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.model-image-editor-head p {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.model-image-editor-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}

.model-image-editor-card,
.model-image-editor-add {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
}

.model-image-editor-card {
  position: relative;
  border: 2px solid transparent;
  background: var(--surface-2);
}

.model-image-editor-card.is-cover {
  border-color: var(--primary);
}

.model-image-editor-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.model-image-editor-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 4px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.15s;
}

.model-image-editor-card:hover .model-image-editor-card-overlay,
.model-image-editor-card.is-cover .model-image-editor-card-overlay {
  opacity: 1;
}

.model-image-editor-icon {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.model-image-editor-icon.danger {
  color: #dc2626;
}

.model-image-editor-badge {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.model-image-editor-add {
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 28px;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.model-image-editor-add:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.model-image-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-image-editor-status {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.btn-image-edit {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-image-edit.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-image-edit.save {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}

.btn-image-edit.danger {
  color: #dc2626;
  border-color: #fecaca;
}

.model-product-editor {
  margin-top: 16px;
}

.model-product-editor-inner,
.model-image-editor-inner {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 20px;
}

.model-editor-admin-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.model-editor-form {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.model-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.model-editor-full {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.model-editor-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.model-editor-form input,
.model-editor-form select,
.model-editor-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 0;
  font: inherit;
  background: #fff;
}

.model-editor-section {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.model-editor-section h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.model-editor-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.model-editor-file-note {
  font-size: 13px;
  color: var(--text-muted);
}

.model-editor-actions {
  display: flex;
  gap: 10px;
}

.model-image-editor-status.warn {
  color: #b45309;
}

.model-image-editor-status.error {
  color: #dc2626;
}

@media (max-width: 768px) {
  .model-editor-grid {
    grid-template-columns: 1fr;
  }
}
