:root {
  --bg: #0b0e14;
  --surface: #141a24;
  --surface-2: #1b2330;
  --border: #26303f;
  --text: #e8edf4;
  --text-dim: #96a2b4;
  --accent: #4f8cff;
  --green: #34c98e;
  --amber: #f0b429;
  --radius: 12px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
}

.logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--accent);
}

.site-header nav {
  display: flex;
  gap: 4px;
}

.site-header nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
}

.site-header nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* Hero */
.hero {
  padding: 36px 0 28px;
}

.hero h1 {
  font-size: 1.8rem;
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--text-dim);
  margin-top: 6px;
}

/* Grid + cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

.card-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
}

.card-thumb.placeholder.stock {
  background: linear-gradient(135deg, #16233a, #0f1a2c);
}

.card-thumb.placeholder.crypto {
  background: linear-gradient(135deg, #2b2313, #1a1509);
}

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-body h3 {
  font-size: 1.05rem;
  line-height: 1.4;
}

.card-desc {
  color: var(--text-dim);
  font-size: 0.88rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: auto;
}

/* Tags */
.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.74rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.tag.market-stock {
  color: var(--green);
  border-color: rgba(52, 201, 142, 0.35);
}

.tag.market-crypto {
  color: var(--amber);
  border-color: rgba(240, 180, 41, 0.35);
}

.tag.system {
  color: #b18cff;
  border-color: rgba(177, 140, 255, 0.4);
}

.tag.verified {
  color: var(--green);
  border-color: rgba(52, 201, 142, 0.45);
  background: rgba(52, 201, 142, 0.08);
}

.tag.self {
  color: var(--text-dim);
  border-color: var(--border);
}

/* Pipeline diagram */
.sub-heading {
  font-size: 1rem;
  margin-bottom: 10px;
}

.pipeline-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.pipeline {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: max-content;
}

.pipe-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  width: 170px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pipe-label {
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.03em;
  font-weight: 600;
}

.pipe-step p {
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--text);
  word-break: keep-all;
}

.pipe-step .pipe-sub {
  color: var(--text-dim);
  font-size: 0.76rem;
  border-top: 1px dashed var(--border);
  padding-top: 4px;
  margin-top: auto;
}

.pipe-arrow {
  align-self: center;
  color: var(--text-dim);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.pipe-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pipe-fieldset legend {
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 0 6px;
}

/* Wallet track record */
.wallet-box {
  background: var(--surface);
  border: 1px solid rgba(52, 201, 142, 0.3);
  border-radius: var(--radius);
  overflow: hidden;
}

.wallet-addr {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.wallet-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wallet-empty {
  padding: 16px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pos {
  color: var(--green);
}

.neg {
  color: #ff8a8a;
}

.chart-title {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}

.pnl-chart {
  width: 100%;
  height: auto;
  display: block;
}

.pnl-chart .grid {
  stroke: var(--border);
  stroke-width: 1;
}

.pnl-chart .grid.zero {
  stroke-dasharray: 4 4;
}

.pnl-chart .area {
  fill: rgba(79, 140, 255, 0.12);
}

.pnl-chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
}

.pnl-chart .dot {
  fill: var(--accent);
}

.pnl-chart .hit {
  fill: transparent;
}

.pnl-chart .hit:hover {
  fill: rgba(79, 140, 255, 0.35);
}

.pnl-chart .axis-label {
  fill: var(--text-dim);
  font-size: 11px;
}

.pnl-chart .last-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.fills-wrap {
  overflow-x: auto;
}

.fills-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fills-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  padding: 6px 10px;
}

.fills-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

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

.chart-caption {
  color: var(--text-dim);
  font-size: 0.76rem;
}

.empty {
  color: var(--text-dim);
  padding: 48px 0;
  text-align: center;
}

/* System detail */
.source-note {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
}

.source-note strong {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.source-note p {
  font-size: 0.95rem;
  white-space: pre-wrap;
}

.caution {
  background: rgba(240, 180, 41, 0.08);
  border: 1px solid rgba(240, 180, 41, 0.3);
  color: #d9b96a;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.readme-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.readme {
  padding: 20px 24px;
  overflow-x: auto;
  font-size: 0.92rem;
  color: #cdd7e4;
}

.readme h1,
.readme h2,
.readme h3,
.readme h4 {
  color: var(--text);
  margin: 22px 0 10px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.readme h1 {
  font-size: 1.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.readme h2 {
  font-size: 1.15rem;
}

.readme h3 {
  font-size: 1rem;
}

.readme p,
.readme li {
  margin: 8px 0;
}

.readme ul,
.readme ol {
  padding-left: 24px;
}

.readme a {
  color: var(--accent);
}

.readme img {
  max-width: 100%;
  border-radius: 8px;
}

.readme pre {
  background: #0b0e14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
  font-size: 0.84rem;
}

.readme code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.86em;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.readme pre code {
  background: none;
  padding: 0;
}

.readme table {
  border-collapse: collapse;
  margin: 12px 0;
}

.readme th,
.readme td {
  border: 1px solid var(--border);
  padding: 6px 12px;
}

.readme blockquote {
  border-left: 3px solid var(--border);
  padding-left: 14px;
  color: var(--text-dim);
  margin: 10px 0;
}

.readme hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* Detail */
.detail {
  max-width: 760px;
  margin: 24px auto 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail h1 {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.detail-desc {
  color: var(--text-dim);
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.meta-table tr:last-child th,
.meta-table tr:last-child td {
  border-bottom: none;
}

.meta-table th {
  color: var(--text-dim);
  font-weight: 500;
  width: 130px;
  white-space: nowrap;
}

.meta-table a {
  color: var(--accent);
  word-break: break-all;
}

/* Prompt box */
.prompt-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.prompt-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.prompt-box-head h2 {
  font-size: 1rem;
}

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

.prompt-box pre {
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.86rem;
  color: #cdd7e4;
  max-height: 480px;
  overflow-y: auto;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  border-color: var(--accent);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 10px 20px;
}

.btn.run.chatgpt {
  border-color: rgba(52, 201, 142, 0.5);
}

.btn.run.claude {
  border-color: rgba(217, 119, 87, 0.6);
}

/* Result */
.result h2 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.result p {
  color: var(--text-dim);
}

.result-img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 10px;
  display: block;
}

/* Form */
.submit-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.submit-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-dim);
  flex: 1;
}

.submit-form input,
.submit-form textarea,
.submit-form select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
}

.submit-form input:focus,
.submit-form textarea:focus,
.submit-form select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-error {
  background: rgba(255, 92, 92, 0.12);
  border: 1px solid rgba(255, 92, 92, 0.4);
  color: #ff9c9c;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 20px;
  text-align: center;
}

.site-footer p {
  max-width: 720px;
  margin: 0 auto;
}
