:root {
  --bg-obsidian: #080809;
  --bg-panel: #0b0b0d;
  --bg-cell: #0e0e11;
  --bg-cell-hover: #17171c;
  --bg-cell-active: #1f1f26;
  --line-strong: rgba(255, 255, 255, 0.24);
  --line-mid: rgba(255, 255, 255, 0.13);
  --line-faint: rgba(255, 255, 255, 0.06);
  --fg-white: #f4f4f2;
  --fg-silver: #a6a8ad;
  --fg-muted: #5e6068;
  --font-sans: "Montserrat", "Futura", "Avenir Next", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-obsidian);
  color: var(--fg-white);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.workspace {
  display: grid;
  grid-template-columns: 244px 1fr 356px;
  height: 100vh;
  width: 100vw;
}

/* ============================================================================
   LEFT COLUMN: EDITORIAL SPECIMEN, XY SCATTER & TELEMETRY
   ============================================================================ */
.col-left {
  background: var(--bg-panel);
  border-right: 1px solid var(--line-mid);
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 2;
}

.spec-header {
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--line-mid);
}

.spec-index-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.spec-index-num {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--fg-white);
}

.spec-type-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--fg-silver);
  border: 1px solid var(--line-mid);
  padding: 2px 5px;
}

.spec-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-white);
  line-height: 1.3;
  margin-bottom: 2px;
}

.spec-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--fg-muted);
}

.section-micro-Head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.section-micro-Head label {
  cursor: pointer;
}

.blueprint-box {
  padding: 10px 16px 11px;
  border-bottom: 1px solid var(--line-mid);
}

.module-blueprint {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 104px;
  background: var(--bg-obsidian);
  border: 1px solid var(--line-mid);
  display: flex;
  align-items: center;
  justify-content: center;
}

.module-blueprint svg {
  width: 100%;
  height: 100%;
  display: block;
}

.input-block {
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--line-mid);
}

#text-input {
  width: 100%;
  background: var(--bg-obsidian);
  color: var(--fg-white);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 7px 9px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.1em;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

#text-input:focus {
  border-color: var(--fg-white);
  background: #000000;
}

/* XY Surface & Shuffle Block */
.scatter-block {
  padding: 11px 16px 12px;
  border-bottom: 1px solid var(--line-mid);
  background: rgba(255, 255, 255, 0.015);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scatter-mode-row {
  margin-bottom: 2px;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.slider-row {
  display: grid;
  grid-template-columns: 74px 1fr 34px;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-silver);
}

.slider-row label {
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

.slider-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--line-strong);
  outline: none;
  cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 9px;
  height: 9px;
  background: var(--fg-white);
  border: none;
  cursor: pointer;
}

.slider-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--fg-white);
}

.btn-shuffle {
  width: 100%;
  background: var(--bg-cell-active);
  color: var(--fg-white);
  border: 1px solid var(--fg-white);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.12s, color 0.12s;
  margin-top: 2px;
}

.btn-shuffle:hover {
  background: var(--fg-white);
  color: var(--bg-obsidian);
}

.shuffle-icon {
  font-size: 12px;
  line-height: 1;
}

.telemetry-block {
  padding: 10px 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.telemetry-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.t-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 10px;
  padding-bottom: 3px;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.07);
}

.t-row dt {
  color: var(--fg-muted);
}

.t-row dd {
  color: var(--fg-silver);
  font-variant-numeric: tabular-nums;
}

.export-block {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line-mid);
  background: var(--bg-obsidian);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tone-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tone-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}

.tone-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line-mid);
}

.tone-switch.tone-switch-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.tone-switch.tone-switch-4 {
  grid-template-columns: repeat(4, auto);
}

.tone-btn {
  background: transparent;
  color: var(--fg-muted);
  border: none;
  padding: 3px 5px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.tone-btn.active {
  background: var(--fg-white);
  color: var(--bg-obsidian);
  font-weight: 600;
}

.btn-export {
  width: 100%;
  background: var(--fg-white);
  color: var(--bg-obsidian);
  border: 1px solid var(--fg-white);
  border-radius: 0;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.12s, color 0.12s;
}

.btn-export:hover {
  background: transparent;
  color: var(--fg-white);
}

.export-arrow {
  font-size: 13px;
  line-height: 1;
}

/* ============================================================================
   CENTER COLUMN: FULL-SCREEN GRID
   ============================================================================ */
.col-center {
  display: grid;
  grid-template-rows: 1fr;
  height: 100vh;
  min-width: 0;
  background: var(--bg-obsidian);
}

.preview-area {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.svg-stage {
  width: 100%;
  height: 100%;
}

.svg-stage svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ============================================================================
   RIGHT COLUMN: SEPARATED GEOMETRIC MODULES & MIX SEQUENCES
   ============================================================================ */
.col-right {
  background: var(--bg-panel);
  border-left: 1px solid var(--line-mid);
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 2;
}

.catalog-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.catalog-single {
  flex: 1.35;
  border-bottom: 1px solid var(--line-mid);
}

.catalog-mix {
  flex: 1;
}

.catalog-header {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-mid);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-obsidian);
  flex-shrink: 0;
}

.catalog-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.catalog-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-white);
}

.catalog-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--fg-silver);
}

.catalog-count {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--fg-muted);
}

/* Crisp 1px Architectural Hairline Grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-mid);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.pattern-card {
  min-width: 0;
  background: var(--bg-cell);
  padding: 6px 5px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
  transition: background 0.1s;
}

.pattern-card:hover {
  background: var(--bg-cell-hover);
}

.pattern-card.active {
  background: var(--bg-cell-active);
  box-shadow: inset 0 0 0 1.5px var(--fg-white);
}

.card-top-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--fg-muted);
  margin-bottom: 2px;
  line-height: 1;
}

.pattern-card.active .card-top-meta {
  color: var(--fg-white);
}

.card-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: transparent;
}

.pattern-card.active .card-dot {
  background: var(--fg-white);
}

.pattern-card svg {
  width: 44px;
  height: 44px;
  display: block;
}

.pattern-name {
  font-size: 9px;
  font-weight: 500;
  color: var(--fg-silver);
  margin-top: 4px;
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pattern-card.active .pattern-name {
  color: var(--fg-white);
  font-weight: 600;
}

/* Custom subtle scrollbars */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: var(--bg-obsidian);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Print sheet */
.col-left { overflow-y: auto; }
.col-left > * { flex-shrink: 0; }
.paper-block { padding: 12px 16px; border-bottom: 1px solid var(--line-mid); }
.paper-block select { width: 100%; padding: 8px; margin-bottom: 10px; background: var(--bg-panel); color: var(--fg-white); border: 1px solid var(--line-mid); font-family: var(--font-mono); font-size: 11px; }
.preview-area { display: flex; align-items: center; justify-content: center; padding: 24px; background: #202023; }
.svg-stage { flex: none; box-shadow: 0 2px 18px #0005; }

.tone-btn:disabled { opacity: .25; cursor: default; }

.module-selection { padding: 9px 12px; border-bottom: 1px solid var(--line-mid); font-size: 10px; flex-shrink: 0; }
.module-selection-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.module-selection button { border: 1px solid var(--line-mid); background: transparent; color: var(--fg-silver); padding: 3px 6px; font-size: 10px; cursor: pointer; }
#module-selection-names { margin-top: 5px; color: var(--fg-silver); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-single .pattern-card.active { box-shadow: inset 0 0 0 2px var(--fg-white); }

.workspace { grid-template-columns: clamp(180px, 19vw, 244px) minmax(0, 1fr) clamp(210px, 25vw, 356px); }
.preview-area { padding: 12px; }
@media (max-width: 1050px) {
  .spec-header, .blueprint-box, .input-block, .scatter-block, .telemetry-block, .export-block, .paper-block { padding-left: 10px; padding-right: 10px; }
  .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tone-label { font-size: 8px; }
  .slider-row { grid-template-columns: 58px minmax(0, 1fr) 30px; }
}
/* Poster controls */
.photo-block,.poster-info-block { padding: 14px 12px; border-bottom: 1px solid var(--line-mid); }
.photo-block input[type="file"] { width: 100%; color: var(--fg-silver); font-size: 10px; }
.photo-block input::file-selector-button { background: var(--fg-white); border: 0; padding: 7px 9px; margin: 0 0 7px; cursor: pointer; }
#photo-status,.field-hint,#export-status { font-size: 10px; color: var(--fg-silver); line-height: 1.5; margin-top: 8px; overflow-wrap: anywhere; }
#photo-controls { margin-top: 10px; }
#photo-controls[hidden] { display: none; }
#photo-controls .slider-row { margin-top: 9px; }
.photo-check { display: flex; gap: 5px; align-items: center; font-size: 10px; color: var(--fg-silver); margin: 14px 0; }
#poster-location { width: 100%; background: transparent; border: 1px solid var(--line-mid); color: var(--fg-white); padding: 8px; font-size: 12px; }
.quiet-button { background: transparent; border: 1px solid var(--line-mid); color: var(--fg-white); padding: 8px; font-size: 10px; cursor: pointer; }
.quiet-button:disabled { opacity: .5; cursor: wait; }
.export-block { margin-top: auto; }
#svg-stage { user-select: none; }

.datetime-label { margin-top: 16px; }
#poster-datetime { width: 100%; resize: vertical; min-height: 66px; background: transparent; border: 1px solid var(--line-mid); color: var(--fg-white); padding: 8px; font: 12px/1.6 var(--font-mono); }

.paper-color-block { padding: 14px 12px; border-bottom: 1px solid var(--line-mid); }
.paper-color-row { display: flex; gap: 8px; }
#paper-color { width: 36px; height: 32px; padding: 0; border: 1px solid var(--line-mid); background: transparent; cursor: pointer; }
#paper-color-hex { min-width: 0; width: 100%; background: transparent; border: 1px solid var(--line-mid); padding: 6px; color: var(--fg-white); font: 11px var(--font-mono); }
.paper-swatches { display: flex; gap: 9px; margin-top: 12px; }
.paper-swatches button { width: 21px; height: 21px; background: var(--swatch); border: 1px solid #ffffff55; cursor: pointer; }
