/* GridSeed — futuristic HUD panel (CEP-safe: system fonts, no external assets) */

:root {
  --void: #030508;
  --deep: #070b14;
  --surface: #0c1220;
  --elev: #111a2e;
  --elev2: #162236;
  --border: rgba(0, 240, 255, 0.12);
  --border-bright: rgba(0, 240, 255, 0.35);
  --text: #e6f4ff;
  --muted: #7a8fa3;
  --cyan: #00f0ff;
  --cyan-dim: #00b8c4;
  --violet: #a78bfa;
  --magenta: #e879f9;
  --focus: #38bdf8;
  --glow-cyan: 0 0 20px rgba(0, 240, 255, 0.25);
  --glow-violet: 0 0 24px rgba(167, 139, 250, 0.2);
  --font-ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Consolas", monospace;
  color: var(--text);
  background: var(--void);
  font-family: var(--font-ui);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background: var(--void);
  position: relative;
  overflow-x: hidden;
}

/* Ambient grid + vignette */
.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(0, 240, 255, 0.08), transparent 50%),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(167, 139, 250, 0.06), transparent 45%),
    linear-gradient(180deg, var(--void) 0%, var(--deep) 100%);
}

.app-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 75%);
}

.topbar {
  position: relative;
  z-index: 2;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(12, 18, 32, 0.95) 0%, rgba(7, 11, 20, 0.88) 100%);
  box-shadow: 0 1px 0 rgba(0, 240, 255, 0.06), inset 0 -1px 0 rgba(167, 139, 250, 0.05);
}

.topbar-edge {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--cyan);
  border-style: solid;
  opacity: 0.65;
  pointer-events: none;
}

.topbar-edge--tl {
  top: 8px;
  left: 8px;
  border-width: 2px 0 0 2px;
}

.topbar-edge--tr {
  top: 8px;
  right: 8px;
  border-width: 2px 2px 0 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand-mark__inner {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--violet) 100%);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  box-shadow: var(--glow-cyan), inset 0 0 12px rgba(255, 255, 255, 0.15);
  animation: markPulse 4s ease-in-out infinite;
}

@keyframes markPulse {
  0%,
  100% {
    filter: brightness(1);
    box-shadow: var(--glow-cyan), inset 0 0 12px rgba(255, 255, 255, 0.12);
  }
  50% {
    filter: brightness(1.15);
    box-shadow: 0 0 28px rgba(0, 240, 255, 0.35), inset 0 0 14px rgba(255, 255, 255, 0.2);
  }
}

.build-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--cyan);
  vertical-align: middle;
  margin-left: 6px;
  padding: 2px 6px;
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.06);
  letter-spacing: 0.08em;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
  background: linear-gradient(105deg, var(--text) 0%, var(--cyan) 45%, var(--violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.tabs {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.85);
  backdrop-filter: blur(8px);
}

.tab {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(17, 26, 46, 0.6);
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.tab:hover {
  color: var(--text);
  border-color: var(--border-bright);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.08);
}

.tab[aria-selected="true"] {
  color: var(--void);
  border-color: var(--cyan);
  background: linear-gradient(135deg, var(--cyan) 0%, #22d3ee 50%, var(--violet) 100%);
  box-shadow: var(--glow-cyan);
}

.tab:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.main {
  position: relative;
  z-index: 1;
  padding: 14px 14px 22px;
  max-width: 520px;
}

.main--scroll {
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan-dim) var(--surface);
}

.main--scroll::-webkit-scrollbar {
  width: 6px;
}

.main--scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--cyan-dim), var(--violet));
  border-radius: 3px;
}

.panel-update-hint {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0, 240, 255, 0.28);
  background: rgba(0, 240, 255, 0.07);
  font-size: 10px;
  line-height: 1.45;
}

.lede {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  padding: 10px 12px;
  border-left: 2px solid var(--cyan);
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.06), transparent);
  border-radius: 0 8px 8px 0;
}

.lede strong {
  color: var(--cyan);
  font-weight: 600;
}

.hint {
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  border: 1px dashed var(--border);
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 240, 255, 0.03);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack.tight {
  gap: 10px;
}

.card {
  position: relative;
  background: linear-gradient(145deg, var(--elev) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 14px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.card::after {
  content: "";
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-right: 1px solid var(--cyan);
  border-bottom: 1px solid var(--cyan);
  opacity: 0.35;
  pointer-events: none;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.5;
}

.card:hover {
  border-color: var(--border-bright);
  box-shadow: var(--glow-cyan), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
  color: var(--text);
}

.card-meta {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--violet);
}

.card-blurb {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--elev2);
  color: var(--text);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.btn:hover {
  border-color: var(--border-bright);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.12);
}

.btn.primary {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.25) 0%, rgba(167, 139, 250, 0.2) 100%);
  color: var(--text);
  box-shadow: var(--glow-cyan);
}

.btn.primary:hover {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.4) 0%, rgba(167, 139, 250, 0.35) 100%);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-style: dashed;
}

.btn.small {
  font-size: 10px;
  padding: 6px 10px;
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.paper-format-block {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 240, 255, 0.04);
}

.starter-kit-block {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(167, 139, 250, 0.05);
}

.starter-kit-preview {
  margin: 10px 0 10px;
  padding: 8px;
  border-radius: 8px;
  border: 1px dashed rgba(167, 139, 250, 0.35);
  background: rgba(3, 5, 8, 0.35);
}

.template-create-actions--starter-top {
  margin-top: 6px;
}

.paper-format-select select {
  width: 100%;
}

.paper-variant-hint {
  margin: 10px 0 0;
  font-size: 10px;
}

.template-preview {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px dashed rgba(0, 240, 255, 0.22);
  background: rgba(3, 5, 8, 0.55);
}

.template-preview__frame {
  width: 100%;
  max-height: 200px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#templatePreviewSvg {
  width: 100%;
  height: 100%;
  max-height: 200px;
  display: block;
}

.template-preview__caption {
  margin: 8px 0 0;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.panel-divider {
  margin: 4px 0 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.variant-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
  max-height: 168px;
  overflow-y: auto;
  padding-right: 2px;
}

.variant-bar::-webkit-scrollbar {
  width: 6px;
}

.variant-bar::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.25);
  border-radius: 3px;
}

.variant-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.03em;
  line-height: 1.35;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(17, 26, 46, 0.85);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.variant-chip__tag {
  flex-shrink: 0;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan-dim);
}

.variant-chip__label {
  min-width: 0;
}

.variant-chip:hover {
  border-color: var(--border-bright);
}

.variant-chip.is-selected {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}

.paper-format-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(17, 26, 46, 0.8);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chip:hover {
  border-color: var(--violet);
  box-shadow: var(--glow-violet);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 240, 255, 0.04);
}

.toolbar-hint {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--muted);
  flex: 1 1 100%;
  opacity: 0.9;
}

.check {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  accent-color: var(--cyan);
  width: 14px;
  height: 14px;
}

.grid-row {
  position: relative;
  cursor: pointer;
  background: linear-gradient(145deg, var(--elev) 0%, var(--deep) 100%);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.grid-row:hover {
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.08);
}

.grid-row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.grid-name {
  flex: 1 1 auto;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--text);
}

.grid-explain {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.55;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.grid-explain.is-hidden {
  display: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.field span {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan-dim);
  margin-bottom: 6px;
}

.field select {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--elev);
  color: var(--text);
  cursor: pointer;
}

.field select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.15);
}

.words-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.words-actions--split {
  flex-direction: column;
  align-items: stretch;
}

.words-actions--split .btn {
  width: 100%;
}

@media (min-width: 340px) {
  .words-actions--split {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .words-actions--split .btn.primary {
    flex: 1 1 100%;
  }
  .words-actions--split .btn.ghost {
    flex: 1 1 auto;
  }
}

.words-hint {
  margin: 0 0 12px;
  font-size: 10px;
}

.grid-context {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 240, 255, 0.04);
}

.grid-context__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.grid-context__title {
  margin: 0;
}

.grid-context__body {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.grid-help-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.grid-help-list li {
  margin-bottom: 8px;
}

.grid-help-list strong {
  color: var(--text);
}

.copy-preview {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(3, 5, 8, 0.6);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  min-height: 120px;
  box-shadow: inset 0 0 40px rgba(0, 240, 255, 0.03);
}

.tip {
  position: relative;
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(17, 26, 46, 0.5);
}

.tip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
}

.tip-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  color: var(--text);
}

.tip-body {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

/* About tab — project documentation (English labels) */
.about-doc {
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
}

.about-section {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.about-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.about-section__title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan-dim);
  margin: 0 0 8px;
}

.about-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin: 14px 0 6px;
}

.about-subtitle:first-of-type {
  margin-top: 4px;
}

.about-kicker {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 10px;
  line-height: 1.45;
}

.about-section p {
  margin: 0 0 8px;
}

.about-note {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px dashed rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.06);
  font-size: 11px;
}

.about-list {
  margin: 0;
  padding-left: 18px;
}

.about-list li {
  margin-bottom: 6px;
}

.about-list code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--violet);
}

.about-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.about-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  font-family: var(--font-mono);
}

.about-table th,
.about-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.about-table th {
  background: rgba(0, 240, 255, 0.06);
  color: var(--text);
  font-weight: 600;
}

.about-table tbody tr:last-child td {
  border-bottom: none;
}

.about-faq {
  margin: 0;
}

.about-faq dt {
  font-weight: 600;
  color: var(--text);
  margin-top: 10px;
  font-size: 11px;
}

.about-faq dt:first-child {
  margin-top: 0;
}

.about-faq dd {
  margin: 4px 0 0;
  padding-left: 0;
}

.status {
  margin-top: 16px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--cyan);
  min-height: 1.2em;
  border-top: 1px solid var(--border);
  background: rgba(0, 240, 255, 0.04);
  border-radius: 0 0 8px 8px;
}

/* —— 排版预览（原 排版网格预览.html，合并至 index） —— */
.layout-plan-ui {
  --lp-border: rgba(56, 189, 248, 0.28);
  --lp-accent: var(--focus);
  --lp-plan-bg: rgba(56, 189, 248, 0.1);
  --lp-plan-border: rgba(56, 189, 248, 0.45);
  --lp-muted: var(--muted);
  --lp-image: #a78bfa;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.layout-preview__plan {
  border: 1px solid var(--lp-plan-border);
  background: var(--lp-plan-bg);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text);
}

.layout-preview__plan-kicker {
  margin: 0 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--lp-accent);
  font-weight: 600;
}

.layout-preview__plan ul {
  margin: 0;
  padding-left: 1.1em;
}

.layout-preview__plan li {
  margin-bottom: 5px;
}

.layout-preview__pct {
  color: var(--cyan);
  font-weight: 600;
}

.layout-plan-ui fieldset {
  border: 1px solid var(--lp-border);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0;
}

.layout-plan-ui legend {
  padding: 0 6px;
  font-weight: 600;
  font-size: 11px;
}

.layout-plan-ui .lp-span {
  display: block;
  font-size: 10px;
  color: var(--lp-muted);
  margin-bottom: 3px;
}

.layout-plan-ui select,
.layout-plan-ui input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}

.layout-plan-ui .lp-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.layout-plan-ui .lp-row3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.layout-plan-ui .lp-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  cursor: pointer;
  font-size: 11px;
}

.layout-plan-ui .lp-check input {
  width: auto;
}

.layout-plan-ui #lpImageSlots {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.layout-plan-ui .lp-slot-card {
  border: 1px dashed rgba(167, 139, 250, 0.45);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(167, 139, 250, 0.06);
}

.layout-plan-ui .lp-slot-card h3 {
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--lp-image);
}

.layout-plan-ui .lp-mode-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.layout-plan-ui .lp-mode-toggle button {
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.layout-plan-ui .lp-mode-toggle button.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--lp-accent);
  color: var(--text);
}

.layout-plan-ui .hidden {
  display: none !important;
}

.layout-preview__canvas-wrap {
  width: 100%;
  max-height: min(52vh, 420px);
  aspect-ratio: 210 / 297;
  background: #080a0e;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.layout-preview__canvas-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
}

.layout-preview__caption {
  margin: 0;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  font-family: var(--font-mono);
}

.layout-plan-ui .lp-ratio-hint {
  margin: 0;
  padding-top: 4px;
  font-size: 9px;
  color: var(--muted);
}

/* Content layout + image slots (moved from Layout preview tab) */
.template-layout-plan {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.template-layout-plan .lp-slots-hint {
  margin: 0 0 8px;
  font-size: 10px;
}

.template-layout-plan .layout-preview__plan-kicker {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.lp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.novice-intro {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}

.panel-meta-hint {
  margin: 0 0 14px;
  font-size: 9px;
  color: var(--muted);
  opacity: 0.9;
}

.section-title--sub {
  margin-top: 14px;
  margin-bottom: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.template-create-hint {
  margin: 0 0 10px;
  font-size: 10px;
}

.template-create-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
}

.template-create-actions__starter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.start-kit-button {
  font-size: 12px;
  padding: 12px 16px;
}

.template-create-actions__field {
  flex: 1;
  min-width: 120px;
  margin: 0;
}

.template-create-actions__field span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 3px;
}

.template-create-actions__field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}

/* Language switcher (EN / 中文) */
.lang-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.lang-bar--top {
  margin-top: 0;
  margin-bottom: 0;
  padding: 12px 16px;
  border-radius: 0;
  border: none;
  border-bottom: 2px solid var(--border-bright);
  background: linear-gradient(
    180deg,
    rgba(0, 240, 255, 0.14) 0%,
    rgba(12, 18, 32, 0.92) 55%,
    rgba(7, 11, 20, 0.95) 100%
  );
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 240, 255, 0.08);
  position: relative;
  z-index: 4;
}

.lang-bar--top .lang-bar__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.lang-bar--top .lang-btn {
  min-width: 90px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
}

.lang-bar__label {
  font-size: 10px;
  color: var(--muted);
  margin-right: 4px;
}

.lang-bar .lang-btn {
  min-width: 72px;
}

.lang-bar .lang-btn.is-active {
  border-color: var(--cyan);
  color: var(--text);
  background: rgba(56, 189, 248, 0.12);
}

/* New Templates composer (replaces legacy template blocks visually) */
#panel-templates .starter-kit-block,
#panel-templates .paper-format-block,
#panel-templates .template-layout-plan {
  display: none;
}

.grid-composer {
  display: grid;
  gap: 10px;
  width: 100%;
  min-width: 0;
}
.main.main--scroll,
#panel-templates,
#gridComposerRoot,
.gc-acc,
.gc-body {
  min-width: 0;
}
.main.main--scroll {
  overflow-x: hidden;
}
.gc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(13, 22, 38, 0.66);
}
.gc-title { margin: 0; font-size: 14px; }
.gc-menu-icons { display: flex; gap: 5px; }
.gc-dot { width: 7px; height: 7px; border-radius: 50%; background: #60a5fa; opacity: 0.9; }
.gc-acc {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.42);
}
.gc-acc > summary {
  cursor: pointer;
  padding: 9px 12px;
  font-weight: 700;
}
.gc-body { padding: 0 12px 12px; }
.gc-theme-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.gc-theme-card {
  min-width: 92px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 6px;
  background: rgba(2, 6, 23, 0.48);
}
.gc-theme-card.is-selected { border-color: #60a5fa; box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.4) inset; }
.gc-theme-thumb {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  margin: 0 auto 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}
.gc-theme-name { text-align: center; font-size: 11px; line-height: 1.2; min-height: 28px; }
.gc-segment { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.gc-segment--print { margin-top: -2px; }
.gc-seg-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(2, 6, 23, 0.5);
  color: #dbeafe;
  cursor: pointer;
}
.gc-seg-btn.is-selected { border-color: #60a5fa; background: rgba(37, 99, 235, 0.22); }
.gc-wh-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gc-tune-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.gc-layout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
.gc-layout-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  padding: 7px 6px;
  background: rgba(2, 6, 23, 0.55);
  color: #dbeafe;
  cursor: pointer;
  font-size: 11px;
  width: 100%;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
}
.gc-layout-btn.is-selected { border-color: #60a5fa; background: rgba(37, 99, 235, 0.22); }
.gc-layout-icon { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; margin-bottom: 5px; height: 38px; }
.gc-layout-icon i { display: block; border-radius: 2px; background: rgba(148, 163, 184, 0.35); }
.gc-create-btn {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 10px;
  font-weight: 800;
  background: #1d4ed8;
  color: #fff;
  cursor: pointer;
}
.gc-create-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.gc-preview-box {
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 10px;
  padding: 8px;
  background: rgba(2, 6, 23, 0.5);
}
#gcPreviewSvg { width: 100%; height: auto; min-height: 220px; display: block; }
.gc-preview-actions { margin-top: 10px; display: grid; gap: 8px; grid-template-columns: 1fr; width: 100%; }
.gc-preset-list {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.gc-preset-card {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(2, 6, 23, 0.52);
  border-radius: 8px;
  padding: 8px;
  color: #dbeafe;
  text-align: left;
}
.gc-preset-card strong {
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
}
.gc-preset-card span {
  display: block;
  font-size: 10px;
  opacity: 0.9;
}

@media (min-width: 420px) {
  .gc-layout-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gc-preview-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gc-preset-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
