/* 九宫格切图页专属样式 */

.page-nine {
  max-width: 1180px;
}

.page-nine.is-editing {
  max-width: 1280px;
  padding-top: 12px;
  padding-bottom: 16px;
}

.page-nine.is-editing .header,
.page-nine.is-editing .seo-content,
.page-nine.is-editing .footer {
  display: none !important;
}

.page-nine.is-editing .panel {
  padding: 14px;
}

.nine-workspace[hidden] {
  display: none !important;
}

.nine-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  margin-top: 4px;
}

.nine-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nine-stage {
  position: relative;
  height: var(--nine-stage-h, min(52vh, 520px));
  min-height: 240px;
  border-radius: 16px;
  overflow: hidden;
  background: #0f1720;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
}

.nine-stage.can-pan {
  cursor: grab;
}

.nine-stage.is-panning {
  cursor: grabbing;
}

.nine-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.nine-stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nine-meta {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.nine-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.nine-pieces {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.nine-piece {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  aspect-ratio: 1;
}

.nine-piece img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nine-piece .piece-num {
  position: absolute;
  left: 6px;
  top: 6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.92);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.nine-piece a {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(24, 33, 43, 0.72);
  color: #fff;
  font-size: 0.68rem;
}

.nine-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-height: calc(var(--nine-stage-h, 52vh) + 160px);
  overflow: hidden;
}

.nine-sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 2px;
}

.side-block {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.side-block h3 {
  margin: 0 0 10px;
  font-size: 0.88rem;
  font-weight: 600;
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seg-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}

.seg-btn:hover {
  border-color: rgba(15, 118, 110, 0.3);
  color: var(--ink);
}

.seg-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.75rem;
  color: var(--muted);
}

.field:last-child {
  margin-bottom: 0;
}

.field > span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.field > span em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.field select,
.field input[type="range"] {
  width: 100%;
}

.field select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.88rem;
  color: var(--ink);
  background: #fff;
  font-family: inherit;
}

.field select:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.field input[type="range"] {
  accent-color: var(--accent);
}

.hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink);
  cursor: pointer;
}

.check-inline input {
  accent-color: var(--accent);
}

.side-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.btn-block {
  width: 100%;
}

.side-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#quality-field[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .nine-layout {
    grid-template-columns: 1fr;
  }

  .nine-sidebar {
    max-height: min(70vh, 640px);
  }

  .nine-stage {
    height: min(42vh, 360px);
  }
}
