/* image-edit-lab — self-contained dark shell (hub.css may enhance when present) */
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Instrument+Serif:ital@0;1&family=Noto+Sans+TC:wght@400;500;600;700&display=swap");

*, *::before, *::after { box-sizing: border-box; }

html:has(body.lab-page) {
  background: #05070c;
  color-scheme: dark;
  scroll-behavior: smooth;
}

body.lab-page {
  --bg: #05070c;
  --panel: #10151f;
  --text: #f0f4fa;
  --muted: #8a96a8;
  --muted-2: #5c6778;
  --accent: #6eb5ff;
  --green: #6dd4a0;
  --gold: #e8c06a;
  --border: rgba(148, 168, 200, 0.12);
  --radius: 16px;
  --font-display: "Instrument Serif", "Noto Serif TC", Georgia, serif;
  --font-body: "DM Sans", "Noto Sans TC", system-ui, sans-serif;
  --sky: var(--accent);
  --ok: var(--green);
  --warn: var(--gold);
  --err: #ff8fa3;

  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.lab-page .bg-aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 8% -5%, rgba(61, 111, 168, 0.35), transparent 58%),
    radial-gradient(ellipse 50% 45% at 92% 8%, rgba(109, 212, 160, 0.12), transparent 52%),
    radial-gradient(ellipse 40% 35% at 70% 85%, rgba(167, 139, 250, 0.08), transparent 50%);
}

body.lab-page .bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

body.lab-page main.hub-page {
  position: relative;
  z-index: 1;
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.25rem 1.75rem 4rem;
}

body.lab-page .page-breadcrumb {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

body.lab-page .page-breadcrumb span { margin: 0 0.35rem; }

body.lab-page .content-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
}

.lab-page .lab-hero {
  margin-bottom: 1.75rem;
}

.lab-page .lab-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 0.5rem;
}

.lab-page .lab-hero h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.5rem);
  color: var(--text);
}

.lab-page .lab-lead {
  margin: 0 0 1rem;
  color: var(--muted);
  max-width: 62ch;
}

.lab-page .lab-hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.88rem;
}

.lab-page .lab-hero-links a {
  color: var(--accent);
  text-decoration: none;
}

.lab-page .lab-hero-links a:hover {
  text-decoration: underline;
}

.lab-page .block {
  margin-bottom: 1.25rem;
}

.lab-page .block h2 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}

.lab-page .section-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
}

.lab-page .lab-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

.lab-page code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}

/* Blocks — content-card from hub.css provides shell; keep inner lab widgets */

/* Quick start */
.steps {
  margin: 0.5rem 0 0 1.25rem;
  font-size: 1rem;
  color: var(--muted);
}
.steps li { margin-bottom: 0.65rem; }
.steps strong { color: var(--text); }

/* Kind legend — each term in its own card (dt/dd grid breaks pairing) */
.kind-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}
.kind-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}
.kind-card .kind-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 0.35rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.kind-card .kind-desc {
  font-size: 0.98rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* Fixture groups */
.fixture-group { margin-bottom: 1.5rem; }
.fixture-group:last-child { margin-bottom: 0; }
.fixture-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}
.fixture-group-head h3 {
  font-size: 1.05rem;
  color: var(--text);
}
.fixture-group-head .tag {
  font-size: 0.82rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(155, 140, 255, 0.2);
  color: var(--accent);
}
.fixture-group-head .tag.life {
  background: rgba(110, 197, 255, 0.15);
  color: var(--sky);
}
.fixture-group-head p {
  flex: 1 1 100%;
  font-size: 0.95rem;
  color: var(--muted);
}

.fixture-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 300px));
  gap: 1.15rem;
  align-items: start;
}
.fixture-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  max-width: 300px;
}
.fixture-card img {
  width: 100%;
  display: block;
  border-bottom: 1px solid var(--border);
  aspect-ratio: 4/3;
  max-height: 220px;
  object-fit: cover;
}
.fixture-card img.portrait {
  aspect-ratio: 2/3;
  max-height: 320px;
}
.fixture-card .body { padding: 0.85rem 1rem 1rem; }
.fixture-card h4 {
  font-size: 1.02rem;
  margin-bottom: 0.25rem;
}
.fixture-card .sub {
  font-size: 0.88rem;
  color: var(--gold);
}

/* Skills */
.skill-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.18);
}
.skill-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem 1rem;
  align-items: start;
  margin-bottom: 0.85rem;
}
.skill-order {
  font-size: 1.35rem;
  color: var(--gold);
  font-weight: 700;
  line-height: 1.2;
}
.skill-head h3 {
  font-size: 1.08rem;
  margin-bottom: 0.25rem;
}
.skill-head .goal {
  font-size: 0.98rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.skill-head .when {
  font-size: 0.92rem;
  color: var(--muted);
}
.kind-tag {
  font-size: 0.82rem;
  color: var(--accent-dim);
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}

.prompt-box {
  font-size: 0.92rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}
.prompt-box li { margin-bottom: 0.4rem; }
.prompt-box strong { color: var(--text); }

.skill-block table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin-top: 0.5rem;
}
.skill-block th,
.skill-block td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.5rem;
  vertical-align: top;
  text-align: center;
}
.skill-block th {
  background: rgba(0, 0, 0, 0.3);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
}
.skill-block th .prio {
  font-size: 0.78rem;
  font-weight: 400;
  margin-top: 0.2rem;
  color: rgba(240, 238, 248, 0.55);
}
.skill-block .cell-img {
  width: 100%;
  max-width: 220px;
  border-radius: 8px;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  margin: 0.35rem auto 0;
  cursor: zoom-in;
}
.fixture-card img,
.demo-thumb img {
  cursor: zoom-in;
}
.skill-merge .cell-img { aspect-ratio: 16/9; }

.lab-page .badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.35rem;
  text-transform: none;
  letter-spacing: normal;
}
.lab-page .badge.ok { background: rgba(125, 255, 178, 0.18); color: var(--ok); }
.lab-page .badge.planned { background: rgba(255, 184, 107, 0.15); color: var(--warn); }
.lab-page .badge.err { background: rgba(255, 143, 163, 0.15); color: var(--err); }

.hint {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 0.65rem;
}
.hint a { color: var(--sky); }
.demo-link { color: var(--sky); font-weight: 500; }
.qa-hint { margin-top: 0.5rem; }

.demo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0 0.5rem;
}
.demo-thumb {
  flex: 1 1 200px;
  max-width: 280px;
  margin: 0;
}
.demo-thumb img {
  width: 100%;
  border-radius: 10px;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #000;
}
.demo-thumb figcaption {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.style-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.85rem;
  margin: 0;
}
.style-card h4 { margin: 0 0 0.25rem; font-size: 1rem; }
.style-card .sub { font-size: 0.78rem; color: var(--muted); margin: 0 0 0.5rem; }
.style-card .cell-img { max-width: 100%; aspect-ratio: 16/9; }

.prompt-detail {
  text-align: left;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.prompt-detail summary { cursor: pointer; color: var(--accent-dim); }
.pose-gallery-link {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}
.pose-gallery-link a { color: var(--sky); font-weight: 500; }

/* Backends */
.backend-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}
.backend-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: rgba(0, 0, 0, 0.2);
}
.backend-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.backend-card .prio {
  color: var(--gold);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}
.backend-card p {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 0.35rem;
}
.backend-card code { font-size: 0.85rem; color: var(--accent-dim); }

.lab-page .lab-footer code { color: var(--sky); font-size: 0.85rem; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 14, 0.92);
  backdrop-filter: blur(8px);
}
.lightbox[hidden] { display: none; }
.lightbox-body {
  margin: 0;
  max-width: min(96vw, 1200px);
  max-height: 90vh;
  text-align: center;
}
.lightbox-body img {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
}
.lightbox-body figcaption {
  margin-top: 0.75rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-hint {
  position: absolute;
  bottom: 1rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(240, 238, 248, 0.45);
  margin: 0;
}

@media (max-width: 640px) {
  html { font-size: 16px; }
  body.lab-page { padding: 0; }
  .skill-block { overflow-x: auto; }
  .skill-head { grid-template-columns: auto 1fr; }
  .kind-tag { grid-column: 1 / -1; justify-self: start; }
}
