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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 720px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2em;
  color: #f0a030;
  margin-bottom: 4px;
}

header .subtitle {
  color: #888;
  font-size: 0.95em;
}

header .credit {
  color: #666;
  font-size: 0.8em;
  margin-top: 4px;
}

.version-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.version-badge {
  background: #0f3460;
  color: #f0a030;
  font-size: 0.8em;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid #f0a030;
}

.changelog-link {
  color: #888;
  font-size: 0.8em;
  text-decoration: none;
  border-bottom: 1px dotted #666;
}

.changelog-link:hover {
  color: #f0a030;
  border-color: #f0a030;
}

.how-it-works {
  background: #16213e;
  border: 1px solid #2a2a4e;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.how-it-works h2 {
  color: #f0a030;
  font-size: 1.2em;
  margin-bottom: 10px;
}

.how-it-works h3 {
  color: #ccc;
  font-size: 1em;
  margin-top: 16px;
  margin-bottom: 6px;
}

.how-it-works p {
  color: #bbb;
  font-size: 0.9em;
  margin-bottom: 10px;
}

.how-it-works ul, .how-it-works ol {
  color: #bbb;
  font-size: 0.9em;
  padding-left: 20px;
  margin-bottom: 8px;
}

.how-it-works li { margin-bottom: 4px; }

.how-it-works code {
  background: #0f3460;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
  color: #f0a030;
}

.how-it-works a {
  color: #f0a030;
  text-decoration: none;
}

.how-it-works a:hover { text-decoration: underline; }

.trait-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  margin: 10px 0 16px;
}

.trait-table th {
  text-align: left;
  color: #f0a030;
  border-bottom: 1px solid #444;
  padding: 6px 8px;
}

.trait-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #2a2a4e;
  color: #bbb;
}

.trait-table tr:hover td { background: #1a2a4e; }

.trait-tree {
  background: #111827;
  border: 1px solid #2a2a4e;
  border-radius: 6px;
  padding: 16px 20px;
  margin: 12px 0 16px;
  font-size: 0.85em;
  overflow-x: auto;
}

.tree-root {
  color: #f0a030;
  font-weight: bold;
  font-size: 1.1em;
  margin-bottom: 4px;
}

.trait-tree ul.tree {
  list-style: none;
  padding-left: 0;
}

.trait-tree ul {
  list-style: none;
  padding-left: 20px;
  border-left: 1px solid #333;
}

.trait-tree li {
  position: relative;
  padding: 3px 0 3px 14px;
  color: #bbb;
}

.trait-tree li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 10px;
  border-top: 1px solid #333;
}

.tree-branch {
  color: #60a5fa;
  font-weight: bold;
}

.tree-arch {
  color: #f0a030;
  font-weight: bold;
}

.tree-cat {
  color: #34d399;
  font-weight: bold;
}

.tree-stats {
  color: #666;
  font-size: 0.9em;
  margin-left: 6px;
}

.tree-traits li {
  color: #bbb;
}

.tree-traits em {
  color: #888;
  font-style: normal;
  margin-left: 4px;
}

.tree-traits em::before { content: '— '; color: #555; }

.param-desc {
  color: #999;
  font-size: 0.82em;
  line-height: 1.5;
  margin-bottom: 8px;
}

.welcome-preview {
  background: #111;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
  font-family: monospace;
  font-size: 0.85em;
  color: #ccc;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 0;
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  background: #16213e;
  border: 1px solid #333;
  border-bottom: none;
  color: #888;
  font-size: 0.95em;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: background 0.15s, color 0.15s;
}

.tab-btn.active {
  background: #0f3460;
  color: #f0a030;
  border-color: #f0a030;
}

.tab-btn:hover:not(.active) {
  background: #1a2a4e;
  color: #ccc;
}

.panel {
  display: none;
  background: #0f3460;
  border: 1px solid #333;
  border-radius: 0 0 8px 8px;
  padding: 24px;
}

.panel.active { display: block; }

.param-row {
  margin-bottom: 18px;
}

.param-row label {
  display: block;
  font-size: 0.85em;
  color: #aaa;
  margin-bottom: 6px;
}

.param-row label strong {
  color: #e0e0e0;
  font-size: 1.05em;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-group input[type="range"] {
  flex: 1;
  accent-color: #f0a030;
  height: 6px;
}

.slider-group input[type="number"] {
  width: 70px;
  padding: 4px 6px;
  background: #16213e;
  border: 1px solid #444;
  color: #e0e0e0;
  border-radius: 4px;
  font-size: 0.95em;
  text-align: center;
}

.faction-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.faction-btn {
  flex: 1;
  padding: 10px;
  background: #16213e;
  border: 2px solid #333;
  color: #aaa;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
  transition: all 0.15s;
}

.faction-btn.active {
  border-color: #f0a030;
  color: #f0a030;
  background: #1a2a4e;
}

.faction-btn:hover:not(.active) {
  border-color: #666;
  color: #ccc;
}

.faction-rarity-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.faction-rarity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #16213e;
  padding: 8px 12px;
  border-radius: 4px;
}

.faction-rarity-row .faction-label {
  width: 70px;
  font-weight: bold;
  color: #f0a030;
  font-size: 0.9em;
}

.faction-rarity-row label {
  font-size: 0.82em;
  color: #aaa;
  display: flex;
  align-items: center;
  gap: 6px;
}

.faction-rarity-row input[type="number"] {
  width: 54px;
  padding: 4px 6px;
  background: #0f3460;
  border: 1px solid #444;
  color: #e0e0e0;
  border-radius: 4px;
  font-size: 0.95em;
  text-align: center;
}

.pct-label {
  text-align: center;
  font-size: 1.3em;
  color: #f0a030;
  margin-bottom: 12px;
  font-weight: bold;
}

.generate-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: #f0a030;
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  font-size: 1.05em;
  font-weight: bold;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}

.generate-btn:hover { background: #e09020; }

.output-section {
  margin-top: 16px;
  display: none;
}

.output-section.visible { display: block; }

.output-label {
  font-size: 0.9em;
  font-weight: bold;
  color: #f0a030;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.size-counter {
  font-size: 0.9em;
  font-weight: bold;
}

.size-counter.ok { color: #4caf50; }
.size-counter.warn { color: #ff9800; }
.size-counter.over { color: #f44336; }

.usage-hint {
  font-size: 0.85em;
  color: #888;
  font-family: monospace;
}

#output, .output-section textarea {
  width: 100%;
  height: 120px;
  background: #111;
  color: #0f0;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 10px;
  font-family: monospace;
  font-size: 0.8em;
  resize: vertical;
  word-break: break-all;
}

.copy-btn {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: #16213e;
  color: #f0a030;
  border: 1px solid #f0a030;
  border-radius: 6px;
  font-size: 0.95em;
  cursor: pointer;
  transition: background 0.15s;
}

.copy-btn:hover { background: #1a2a4e; }
.copy-btn.copied { background: #2e7d32; color: #fff; border-color: #4caf50; }

@media (max-width: 600px) {
  body { padding: 10px; }
  .panel { padding: 16px; }
  header h1 { font-size: 1.5em; }
}
