@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500&display=swap');

:root {
  --ttm-bg: #f7f6f3;
  --ttm-surface: #ffffff;
  --ttm-border: #e2e0db;
  --ttm-border-dark: #c8c5be;
  --ttm-text: #1a1915;
  --ttm-text-dim: #8a8780;
  --ttm-text-dimmer: #b8b5ae;
  --ttm-accent: #2d6a4f;
  --ttm-accent-light: #e8f3ee;
  --ttm-accent-dim: #74b494;
  --ttm-line: #dedad4;
  --ttm-hover: #f0ede8;
  --ttm-tag-bg: #eeece8;
}

/* ── WRAPPER (scoped — does not affect the rest of your site) ── */
.ttm-wrapper {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--ttm-text);
  line-height: 1.5;
  background: var(--ttm-bg);
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
}

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

/* ── HEADER ── */
.ttm-header {
  width: 100%;
  max-width: 680px;
  margin-bottom: 32px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.ttm-header-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ttm-text);
  letter-spacing: -0.01em;
}
.ttm-header-title span { color: var(--ttm-accent); }
.ttm-header-sub {
  font-size: 11px;
  color: var(--ttm-text-dimmer);
}

/* ── LAYOUT ── */
.ttm-layout {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── FILE TREE ── */
.ttm-tree-row {
  display: flex;
  align-items: stretch;
  position: relative;
}
.ttm-tree-row::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--ttm-line);
  z-index: 0;
}
.ttm-tree-row:last-child::before { display: none; }

.ttm-tree-indent {
  width: 32px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
}
.ttm-tree-indent::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--ttm-line);
}

.ttm-tree-node {
  flex: 1;
  border: 1px solid var(--ttm-border);
  background: var(--ttm-surface);
  margin: 3px 0;
  position: relative;
  z-index: 1;
  transition: border-color 0.12s;
}
.ttm-tree-node:hover { border-color: var(--ttm-border-dark); }
.ttm-tree-node.root  { border-color: var(--ttm-border-dark); }

/* Node header */
.ttm-node-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: default;
  user-select: none;
}
.ttm-node-header.clickable { cursor: pointer; }
.ttm-node-header.clickable:hover { background: var(--ttm-hover); }

.ttm-node-icon {
  font-size: 11px;
  color: var(--ttm-text-dimmer);
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}
.ttm-node-icon.green { color: var(--ttm-accent); }

.ttm-node-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--ttm-text);
  flex: 1;
}
.ttm-node-label .ext { color: var(--ttm-text-dim); }

.ttm-node-meta {
  font-size: 10.5px;
  color: var(--ttm-text-dimmer);
}

.ttm-node-tag {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--ttm-tag-bg);
  color: var(--ttm-text-dim);
  border-radius: 2px;
}
.ttm-node-tag.green {
  background: var(--ttm-accent-light);
  color: var(--ttm-accent);
}

.ttm-chevron {
  font-size: 9px;
  color: var(--ttm-text-dimmer);
  transition: transform 0.15s;
  margin-left: 4px;
}
.ttm-chevron.open { transform: rotate(90deg); }

/* Node body */
.ttm-node-body {
  border-top: 1px solid var(--ttm-border);
  padding: 12px 16px;
  display: none;
  background: #fdfcfb;
}
.ttm-node-body.open { display: block; }

/* ── FIELDS ── */
.ttm-field { margin-bottom: 14px; }
.ttm-field:last-child { margin-bottom: 0; }

.ttm-field-label {
  font-size: 10.5px;
  color: var(--ttm-text-dim);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ttm-field-label::before {
  content: '—';
  color: var(--ttm-text-dimmer);
  font-size: 9px;
}

.ttm-wrapper textarea,
.ttm-wrapper input[type=number],
.ttm-wrapper select {
  width: 100%;
  max-width: 100%;
  background: var(--ttm-bg);
  border: 1px solid var(--ttm-border);
  border-radius: 2px;
  color: var(--ttm-text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.12s;
  appearance: none;
  resize: none;
}
.ttm-wrapper textarea:focus,
.ttm-wrapper input[type=number]:focus,
.ttm-wrapper select:focus {
  border-color: var(--ttm-accent-dim);
  background: var(--ttm-surface);
}
.ttm-wrapper textarea {
  min-height: 52px;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.ttm-hint-text {
  font-size: 10px;
  color: var(--ttm-text-dimmer);
  margin-top: 4px;
}
.ttm-hint-text b { color: var(--ttm-text-dim); font-weight: 500; }

/* Range */
.ttm-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ttm-wrapper input[type=range] {
  flex: 1;
  accent-color: var(--ttm-accent);
  cursor: pointer;
  height: 20px;
  padding: 0;
  background: transparent;
  border: none;
  margin: 0;
}
.ttm-range-val {
  font-size: 11.5px;
  color: var(--ttm-accent);
  min-width: 20px;
  text-align: right;
}

/* Grids */
.ttm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ttm-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── PREVIEW ── */
.ttm-preview-wrap {
  overflow-x: auto;
  background: var(--ttm-bg);
  border: 1px solid var(--ttm-border);
  border-radius: 2px;
  padding: 12px;
}
.ttm-wrapper canvas {
  display: block;
  image-rendering: pixelated;
}
.ttm-preview-file-label {
  font-size: 10px;
  color: var(--ttm-text-dimmer);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ttm-preview-file-label::before { content: '▸'; color: var(--ttm-accent); }
.ttm-preview-item + .ttm-preview-item { margin-top: 14px; }

/* ── BUTTON ── */
.ttm-gen-btn {
  width: 100%;
  background: var(--ttm-accent);
  color: #fff;
  border: none;
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.12s;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ttm-gen-btn:hover { background: #25593f; }
.ttm-gen-btn::before { content: '$'; opacity: 0.6; }

.ttm-status-line {
  font-size: 10.5px;
  color: var(--ttm-text-dimmer);
  margin-top: 8px;
  min-height: 16px;
  padding-left: 2px;
}
.ttm-status-line.ok  { color: var(--ttm-accent); }
.ttm-status-line.err { color: #c0392b; }

/* ── DOWNLOAD LIST ── */
.ttm-dl-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
}
.ttm-dl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--ttm-line);
  animation: ttmFadeUp 0.2s ease;
}
.ttm-dl-item:last-child { border-bottom: none; }
@keyframes ttmFadeUp {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ttm-dl-name {
  font-size: 11.5px;
  color: var(--ttm-text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ttm-dl-name .icon { color: var(--ttm-accent); }
.ttm-dl-name .size { color: var(--ttm-text-dimmer); font-size: 10.5px; }
.ttm-dl-link {
  font-size: 10.5px;
  color: var(--ttm-accent);
  text-decoration: none;
  padding: 3px 8px;
  border: 1px solid var(--ttm-accent-dim);
  border-radius: 2px;
  transition: background 0.1s;
}
.ttm-dl-link:hover { background: var(--ttm-accent-light); }

/* ── DOWNLOAD ALL ── */
.ttm-dl-all:empty { display: none; }
.ttm-dl-all-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ttm-accent);
  text-decoration: none;
  padding: 7px 12px;
  border: 1px solid var(--ttm-accent-dim);
  border-radius: 2px;
  background: var(--ttm-accent-light);
  transition: filter 0.1s;
}
.ttm-dl-all-link:hover { filter: brightness(0.97); }

/* ── SEPARATOR ── */
.ttm-sep {
  height: 1px;
  background: var(--ttm-line);
  margin: 6px 0;
}
