/* 方块梦工厂 · MC 风格深色主题
   —— 像素感边框 / 翡翠绿主色 / 无外部依赖 —— */
:root {
  --bg: #0d1117;
  --bg2: #10151d;
  --panel: #161d29;
  --panel2: #1b2433;
  --line: #2c3a4f;
  --line-bright: #3d5170;
  --text: #e8eef7;
  --muted: #8ea0b8;
  --accent: #34d399;
  --accent-dark: #0f7a52;
  --gold: #f5c542;
  --red: #f87171;
  --radius: 4px;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
  --input-bg: #0c1119;
  --card-bg: #10161f;
  --topbar-bg: rgba(13, 17, 23, .92);
}

/* ============ 浅色主题 ============ */
html.light {
  color-scheme: light;
  --bg: #edf1f6;
  --bg2: #f6f9fc;
  --panel: #ffffff;
  --panel2: #eef3f8;
  --line: #cdd8e4;
  --line-bright: #a9bccf;
  --text: #1b2733;
  --muted: #5d6f82;
  --accent: #0e9d63;
  --accent-dark: #0a7a4c;
  --gold: #a97c0a;
  --red: #d64545;
  --input-bg: #ffffff;
  --card-bg: #f7fafc;
  --topbar-bg: rgba(255, 255, 255, .92);
}
html.light body {
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(14, 157, 99, .08), transparent 60%),
    radial-gradient(900px 400px at 10% 110%, rgba(169, 124, 10, .06), transparent 60%),
    var(--bg);
}
html.light .banner {
  color: #8a6d1a;
  background: linear-gradient(90deg, rgba(245, 197, 66, .28), rgba(245, 197, 66, .1));
  border-bottom-color: rgba(169, 124, 10, .35);
}
html.light .panel { box-shadow: 0 6px 18px rgba(30, 50, 80, .08); }
html.light .topbar { box-shadow: 0 2px 10px rgba(30, 50, 80, .06); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(52, 211, 153, .08), transparent 60%),
    radial-gradient(900px 400px at 10% 110%, rgba(245, 197, 66, .05), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.65 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
}
code { font-family: var(--mono); background: rgba(52,211,153,.12); padding: 1px 6px; border-radius: 3px; color: #7ee2b8; }
.hidden { display: none !important; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 22px;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.brand-logo { width: 30px; height: 30px; image-rendering: pixelated; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 1px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; margin-top: 3px; }
.tabs { display: flex; gap: 6px; margin-left: auto; }
.tab {
  background: none; border: 2px solid transparent; color: var(--muted);
  padding: 6px 14px; border-radius: var(--radius); cursor: pointer;
  font: inherit; font-size: 14px; transition: .15s;
}
.tab:hover { color: var(--text); background: var(--panel); }
.tab.active { color: var(--accent); border-color: var(--line-bright); background: var(--panel); }
.userchip {
  background: var(--panel); color: var(--muted); border: 2px solid var(--line);
  padding: 5px 12px; border-radius: var(--radius); cursor: pointer; font: inherit; font-size: 13px;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.userchip:hover { color: var(--text); border-color: var(--line-bright); }
.userchip.on { color: var(--accent); }

/* ============ 演示横幅 ============ */
.banner {
  background: linear-gradient(90deg, rgba(245,197,66,.15), rgba(245,197,66,.05));
  border-bottom: 2px solid rgba(245,197,66,.35);
  color: #f3d489; padding: 8px 22px; font-size: 13px; text-align: center;
}

/* ============ 通用 ============ */
main { max-width: 1120px; margin: 0 auto; padding: 26px 22px 90px; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  color: #06281b; background: linear-gradient(#4ade80, #22a865);
  border: 2px solid #0a3d28; border-radius: var(--radius);
  padding: 9px 18px;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.28), inset -2px -2px 0 rgba(0,0,0,.28);
  transition: .12s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: inset 2px 2px 0 rgba(0,0,0,.28); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.btn.big { padding: 12px 26px; font-size: 16px; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.full { width: 100%; }
.btn.ghost {
  color: var(--text); background: var(--panel2);
  border-color: var(--line-bright); box-shadow: none;
}
.btn.gold { background: linear-gradient(#ffd868, #e3a90f); border-color: #6b4d00; color: #3c2a00; margin-top: 10px; }

.input {
  width: 100%; font: inherit; color: var(--text);
  background: var(--input-bg); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 9px 12px; outline: none; transition: .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52,211,153,.12); }
.select { cursor: pointer; }
textarea.input { resize: vertical; line-height: 1.6; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg2) 100%);
  border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 8px 24px rgba(0,0,0,.25);
}
.panel h3 { font-size: 15px; margin-bottom: 12px; color: #cfe3d8; }
.panel.narrow { max-width: 460px; margin: 30px auto; }

/* ============ 首页 ============ */
.hero { text-align: center; padding: 46px 10px 30px; }
.hero h1 { font-size: clamp(26px, 4.6vw, 42px); line-height: 1.3; letter-spacing: 1px; }
.hero .hl { color: var(--accent); text-shadow: 0 0 24px rgba(52,211,153,.45); }
.hero-sub { color: var(--muted); max-width: 640px; margin: 14px auto 0; }
.cta-row { display: flex; gap: 14px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.hero-note { margin-top: 16px; color: var(--muted); font-size: 13px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 34px; }
.step-card {
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px; position: relative;
}
.step-num {
  width: 30px; height: 30px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dark); border: 2px solid #0a3d28;
  font-weight: 700; color: #d8ffe9; margin-bottom: 10px;
}
.step-card h3 { font-size: 15px; margin-bottom: 6px; }
.step-card p { color: var(--muted); font-size: 13.5px; }

.section-title { font-size: 18px; margin: 40px 0 14px; letter-spacing: 1px; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; max-width: 1080px; }
.price-card {
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
}
.price-card.pro { border-color: rgba(245,197,66,.4); }
.price-head { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.badge {
  font-size: 11px; padding: 1px 8px; border-radius: 20px;
  background: rgba(52,211,153,.15); color: var(--accent); border: 1px solid rgba(52,211,153,.4);
}
.badge.gold { background: rgba(245,197,66,.12); color: var(--gold); border-color: rgba(245,197,66,.4); }
.price-amount { font-size: 26px; font-weight: 700; margin: 8px 0 12px; font-family: var(--mono); }
.price-amount .per { font-size: 13px; font-weight: 400; color: var(--muted); font-family: inherit; }
.price-card .btn { margin-top: 12px; }
.price-card ul { margin-bottom: 4px; }
.price-card ul { list-style: none; display: grid; gap: 7px; font-size: 13.5px; color: #c6d4e4; }

.faq { max-width: 760px; }
.faq details {
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 10px;
}
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { color: var(--muted); margin-top: 8px; font-size: 13.5px; }

/* ============ 素材库 ============ */
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.toolbar .input { flex: 1; }
.toolbar .select { width: 190px; flex: none; }
.seo-text { color: var(--muted); line-height: 1.9; font-size: 13.5px; background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.seo-text b { color: var(--text); }

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

/* ============ Jar 内容查看器 ============ */
.modal-card.wide { max-width: 960px; width: 96vw; }
.hint.bad { color: var(--red); }
.jar-grid { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 12px; margin-top: 10px; }
.jar-tree, .jar-preview { max-height: 440px; overflow: auto; border: 2px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--panel2); }
.jar-tree .dir { color: var(--muted); font-family: var(--mono); font-size: 11.5px; margin: 8px 0 3px; }
.jar-tree .file { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 3px 6px; border-radius: 3px; cursor: pointer; font: inherit; font-size: 12.5px; }
.jar-tree .file:hover { background: var(--panel); }
.jar-tree .file.active { background: var(--accent-dark); color: #eafff4; }
.jar-size { color: var(--muted); font-size: 10.5px; margin-left: 8px; }
.jar-preview img { image-rendering: pixelated; width: 128px; height: 128px; background: repeating-conic-gradient(rgba(128,128,128,.15) 0 25%, transparent 0 50%) 0 0/16px 16px; border: 1px solid var(--line); border-radius: 3px; margin-top: 8px; }
.jar-text { font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; word-break: break-all; margin: 6px 0 0; color: var(--text); }
@media (max-width: 720px) { .jar-grid { grid-template-columns: 1fr; } }
.chip {
  font: inherit; font-size: 13px; cursor: pointer;
  color: var(--muted); background: var(--panel);
  border: 2px solid var(--line); border-radius: var(--radius);
  padding: 4px 12px; transition: .12s;
}
.chip:hover { color: var(--text); }
.chip.active { color: var(--accent); border-color: var(--accent-dark); background: rgba(52,211,153,.08); }
.asset-meta { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.asset-meta .hint { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.asset-card {
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 12px 6px 9px; text-align: center; cursor: pointer;
  transition: .12s; position: relative; user-select: none;
}
.asset-card:hover { border-color: var(--line-bright); transform: translateY(-2px); }
.asset-card.picked { border-color: var(--accent); background: rgba(52,211,153,.08); }
.asset-card.picked::after {
  content: "✓"; position: absolute; top: 2px; right: 6px;
  color: var(--accent); font-weight: 700; font-size: 13px;
}
.asset-icon {
  width: 42px; height: 42px; margin: 0 auto 7px;
  image-rendering: pixelated;
  display: flex; align-items: center; justify-content: center;
}
.asset-icon img { width: 100%; height: 100%; image-rendering: pixelated; filter: drop-shadow(2px 3px 1px rgba(0,0,0,.45)); }
.asset-icon .ph {
  width: 100%; height: 100%; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: #06281b;
}
.asset-name { font-size: 12.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-id { font-size: 10.5px; color: var(--muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 素材篮浮条 ============ */
.basket-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  background: var(--panel2); border: 2px solid var(--accent-dark);
  border-radius: var(--radius); padding: 9px 16px; z-index: 60;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.06);
}
.basket-bar b { color: var(--accent); }

/* ============ 造模组 ============ */
.create-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.row { display: flex; gap: 12px; margin: 12px 0; }
.row.wrap { flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); flex: 1; min-width: 150px; }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; min-width: 220px; }
.field.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }
.basket-preview { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 14px; }
.basket-preview img { width: 30px; height: 30px; image-rendering: pixelated; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 3px; padding: 2px; }
.basket-preview .asset-icon { margin: 0; }

.timeline { list-style: none; display: grid; gap: 8px; margin-bottom: 14px; }
.timeline li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; }
.timeline li i {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--line-bright); flex: none; transition: .2s;
}
.timeline li.active { color: var(--text); }
.timeline li.active i { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 10px rgba(52,211,153,.7); animation: pulse 1s infinite; }
.timeline li.ok i { border-color: var(--accent-dark); background: var(--accent-dark); }
.timeline li.err i { border-color: var(--red); background: var(--red); }
.timeline li.err { color: var(--red); }
@keyframes pulse { 50% { opacity: .45; } }

.spec-preview { margin-bottom: 14px; }
.spec-preview.empty { color: var(--muted); font-size: 13.5px; padding: 20px 4px; text-align: center; }
.spec-card { border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--card-bg); }
.spec-title { font-weight: 700; font-size: 15px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spec-theme-dot { width: 14px; height: 14px; border-radius: 3px; border: 2px solid rgba(255,255,255,.25); }
.spec-desc { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.spec-items { display: grid; gap: 7px; }
.spec-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.spec-item .kind {
  font-size: 11px; color: var(--accent); border: 1px solid rgba(52,211,153,.35);
  border-radius: 3px; padding: 0 6px; flex: none; min-width: 52px; text-align: center;
}
.spec-item .icon { width: 26px; height: 26px; image-rendering: pixelated; flex: none; }
.spec-item .icon img { width: 100%; height: 100%; image-rendering: pixelated; }
.spec-json { margin-top: 10px; }
.spec-json summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.spec-json pre { background: var(--input-bg); border: 1px solid var(--line); border-radius: 3px; padding: 10px; overflow: auto; max-height: 260px; font-size: 12px; font-family: var(--mono); margin-top: 8px; }

.result { border: 2px solid var(--accent-dark); border-radius: var(--radius); padding: 14px 16px; background: rgba(52,211,153,.06); margin-top: 12px; }
.result.err { border-color: rgba(248,113,113,.5); background: rgba(248,113,113,.07); }
.result a.dl {
  display: inline-flex; margin-top: 10px; text-decoration: none;
}

/* ============ 账号 ============ */
.auth-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.atab {
  flex: 1; font: inherit; font-size: 14px; cursor: pointer;
  background: var(--panel2); color: var(--muted);
  border: 2px solid var(--line); border-radius: var(--radius); padding: 7px 0;
}
.atab.active { color: var(--accent); border-color: var(--accent-dark); }
.auth-form { display: grid; gap: 12px; }
.auth-msg { margin-top: 10px; font-size: 13px; color: var(--gold); min-height: 18px; }
.auth-msg.err { color: var(--red); }

.profile-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.profile-email { font-size: 16px; font-weight: 700; }
.profile-plan { color: var(--muted); font-size: 13px; margin-top: 4px; }
.token-usage { margin: 14px 0 18px; }
.token-bar { height: 12px; background: var(--input-bg); border: 2px solid var(--line); border-radius: 3px; overflow: hidden; }
.token-bar > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-dark), var(--accent)); transition: width .4s; }
.token-usage span { font-size: 12.5px; color: var(--muted); display: inline-block; margin-top: 6px; }

.task-list { display: grid; gap: 10px; margin-top: 10px; }
.task-card { border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--card-bg); }
.task-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.task-idea { font-size: 13.5px; margin-top: 6px; color: #c6d4e4; }
.task-date { color: var(--muted); font-size: 12px; }
.status-chip { font-size: 11.5px; padding: 1px 9px; border-radius: 20px; border: 1px solid var(--line-bright); color: var(--muted); }
.status-chip.done { color: var(--accent); border-color: var(--accent-dark); }
.status-chip.building, .status-chip.drafted { color: var(--gold); border-color: rgba(245,197,66,.5); }
.status-chip.error { color: var(--red); border-color: rgba(248,113,113,.5); }

/* ============ 页脚 / 通知 ============ */
.footer {
  text-align: center; color: var(--muted); font-size: 12.5px;
  padding: 26px 20px 34px; border-top: 2px solid var(--line);
}
.footer-sub { margin-top: 6px; font-size: 11.5px; opacity: .7; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--panel2); color: var(--text);
  border: 2px solid var(--line-bright); border-radius: var(--radius);
  padding: 10px 20px; z-index: 100; font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: fade .2s ease;
}

/* ============ 弹窗 / 订单 ============ */
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg2) 100%);
  border: 2px solid var(--line-bright); border-radius: var(--radius);
  max-width: 540px; width: 100%; max-height: 84vh; overflow: auto;
  padding: 22px; position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.modal-card h3 { margin-bottom: 12px; }
.modal-close {
  position: absolute; right: 10px; top: 6px;
  background: none; border: none; color: var(--muted);
  font-size: 24px; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { font-size: 13.5px; line-height: 1.75; }
.modal-body ul { margin: 8px 0 10px 20px; }
.modal-body .order-id { font-family: var(--mono); color: var(--accent); }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.order-list { display: grid; gap: 6px; margin-top: 8px; font-size: 13px; }
.order-row {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: 3px; padding: 8px 10px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.order-row .order-id { font-family: var(--mono); color: var(--accent); }

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  .steps, .price-grid { grid-template-columns: 1fr; }
  .create-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
  .toolbar .select { width: 100%; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .tabs { order: 3; width: 100%; justify-content: space-between; }
  main { padding: 18px 14px 100px; }
}

/* ============ MC 贴图图标 ============ */
img.mc-icon {
  width: 16px; height: 16px;
  image-rendering: pixelated;
  vertical-align: -3px;
  margin-right: 6px;
  filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, .35));
}
.btn.big .mc-icon { width: 20px; height: 20px; }
.tab .mc-icon { width: 15px; height: 15px; margin-right: 5px; }
.userchip .mc-icon { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.banner .mc-icon { width: 15px; height: 15px; vertical-align: -3px; }
.basket-bar .mc-icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.price-head .mc-icon { width: 18px; height: 18px; vertical-align: -4px; }
.result .mc-icon { width: 18px; height: 18px; vertical-align: -4px; }
html.light img.mc-icon { filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, .15)); }
