/* ===================== Base ===================== */
:root {
  --bg: #0b1020;
  --bg-soft: #121a30;
  --card: #16203a;
  --card-2: #1b2647;
  --line: #26324f;
  --text: #e8edf7;
  --muted: #9aa6bf;
  --brand: #f0b429;
  --brand-2: #4f8cff;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1a2445 0%, transparent 55%), var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { width: min(1180px, 92vw); margin: 0 auto; }
.muted { color: var(--muted); }

/* ===================== Header ===================== */
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(10px);
  background: rgba(11, 16, 32, .78);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; }
.logo .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #ffd76a);
  color: #201400; display: grid; place-items: center; font-weight: 900;
}
.logo small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: 2px; }
.brand-img { height: 40px; width: auto; display: block; }
@media (max-width: 600px) { .brand-img { height: 31px; } }

/* ===================== Hero (gallery) ===================== */
.hero {
  padding: 0 0 32px;
  text-align: center;
}
.hero-banner { display: block; width: 100%; height: auto; }
.hero .hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 480px) { .hero .hero-cta { flex-direction: column; align-items: stretch; } }
.hero h1 { font-size: clamp(28px, 4.4vw, 46px); line-height: 1.12; margin: 0 0 14px; font-weight: 800; }
.hero h1 .hl { color: var(--brand); }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto; font-size: 17px; }
.hero .steps { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.step {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 13.5px; color: var(--muted);
}
.step b { color: var(--text); }

/* ===================== Toolbar / search ===================== */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin: 34px 0 18px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 20px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; min-width: 250px;
}
.search input { background: none; border: 0; color: var(--text); outline: none; width: 100%; font-size: 14.5px; }

/* ===================== Gallery grid ===================== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; padding-bottom: 60px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-4px); border-color: #3a4a72; }
.thumb { position: relative; aspect-ratio: 16/10; overflow: hidden; background: #0d1428; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .4s ease; }
.card:hover .thumb img { transform: scale(1.04); }
.thumb .badge {
  position: absolute; top: 10px; left: 10px; font-size: 11px; font-weight: 700;
  padding: 5px 10px; border-radius: 999px; color: #0b1020;
}
.thumb .zoom {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0;
  background: rgba(6, 10, 22, .45); color: #fff; font-weight: 600; font-size: 13px; transition: opacity .18s;
}
.thumb:hover .zoom { opacity: 1; }
.card .body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .body h3 { margin: 0; font-size: 17px; }
.card .body p { margin: 0; color: var(--muted); font-size: 13.5px; flex: 1; }
.card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.card .actions { display: flex; gap: 10px; margin-top: 6px; }

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 11px; padding: 11px 16px;
  font-weight: 700; font-size: 14px; cursor: pointer; transition: filter .15s, transform .1s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), #ffcf52); color: #201400; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: #46557f; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; }

/* ===================== Modal preview ===================== */
.modal { position: fixed; inset: 0; z-index: 60; display: none; }
.modal.open { display: block; }
.modal .backdrop { position: absolute; inset: 0; background: rgba(4, 7, 16, .8); backdrop-filter: blur(3px); }
.modal .dialog {
  position: relative; z-index: 1; width: min(1000px, 94vw); max-height: 92vh; margin: 4vh auto 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column;
}
.modal .dialog header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal .dialog header h3 { margin: 0; font-size: 17px; }
.modal .toggle { display: flex; gap: 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.modal .toggle button { background: none; border: 0; color: var(--muted); padding: 6px 14px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; }
.modal .toggle button.active { background: var(--brand); color: #201400; }
.modal .close { background: none; border: 0; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }
.modal .scroll { overflow: auto; padding: 18px; background: #0a0f1e; }
.modal .scroll img { margin: 0 auto; border-radius: 8px; box-shadow: var(--shadow); }
.modal .scroll.mobile img { width: min(380px, 90%); }
.modal .scroll.live { height: 74vh; padding: 14px; overflow: hidden; }
.modal .scroll.live.mobile { background: #0a0f1e; overflow-y: auto; }
.live-badge { left: auto !important; right: 10px; background: #e5484d !important; color: #fff !important; display: inline-flex; align-items: center; gap: 4px; }
.modal footer { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.noweb-note { color: var(--muted); font-size: 13px; text-align: center; padding: 30px; }

/* ===================== Order page ===================== */
.order-head { padding: 28px 0 10px; display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.order-head .preview { width: 300px; flex-shrink: 0; }
.order-head .preview img { border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); max-height: 240px; object-fit: cover; object-position: top; width: 100%; }
.order-head .intro { flex: 1; min-width: 260px; }
.order-head .intro h1 { margin: 0 0 8px; font-size: clamp(24px, 3.4vw, 34px); }
.order-head .chip { display: inline-flex; gap: 7px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }

/* ===================== Form ===================== */
.form-wrap { padding: 20px 0 80px; }
.fsection {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 18px; overflow: hidden;
}
.fsection > .fs-head { padding: 15px 18px; display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.fsection > .fs-head .ic { font-size: 20px; }
.fsection > .fs-head .fs-title { font-weight: 700; font-size: 16px; }
.fsection > .fs-head .fs-desc { color: var(--muted); font-size: 12.5px; }
.fsection > .fs-head .caret { margin-left: auto; color: var(--muted); transition: transform .2s; }
.fsection.collapsed > .fs-head .caret { transform: rotate(-90deg); }
.fsection > .fs-body { padding: 4px 18px 20px; }
.fsection.collapsed > .fs-body { display: none; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field label .req { color: #ff6b6b; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 5px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); padding: 11px 13px; font-size: 14px; font-family: inherit; outline: none; transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand-2); }
.field textarea { min-height: 78px; resize: vertical; }
.field input.invalid, .field textarea.invalid { border-color: #ff6b6b; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* Repeater */
.repeater { display: flex; flex-direction: column; gap: 12px; }
.rep-row {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 13px; position: relative;
}
.rep-row .rep-num { position: absolute; top: -9px; left: 12px; background: var(--card-2); border: 1px solid var(--line); font-size: 11px; color: var(--muted); padding: 1px 8px; border-radius: 999px; }
.rep-row .rep-del { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: #ff8080; cursor: pointer; font-size: 13px; }
.rep-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.rep-fields .rf-full { grid-column: 1 / -1; }
@media (max-width: 560px) { .rep-fields { grid-template-columns: 1fr; } }
.rep-add { align-self: flex-start; }

/* Uploader */
.uploader { background: var(--bg-soft); border: 1px dashed var(--line); border-radius: 12px; padding: 14px; }
.up-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.up-list:empty { margin-top: 0; }
.up-item { position: relative; width: 88px; display: flex; flex-direction: column; align-items: center; gap: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; }
.up-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 7px; }
.up-item.loading { flex-direction: row; width: auto; padding: 8px 12px; }
.up-item .up-name { font-size: 10.5px; color: var(--muted); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.up-item.err { border-color: #ff6b6b; }
.up-item.err .up-name { color: #ff9a9a; max-width: 160px; }
.up-item .up-del { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; background: #ff6b6b; color: #fff; border: 0; font-size: 11px; cursor: pointer; line-height: 1; }

/* Sticky submit bar */
.submit-bar {
  position: sticky; bottom: 0; z-index: 20; margin-top: 20px;
  background: linear-gradient(0deg, rgba(11,16,32,1), rgba(11,16,32,.85));
  border-top: 1px solid var(--line); padding: 14px 0;
}
.submit-bar .container { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.submit-bar .hint { color: var(--muted); font-size: 13px; }

/* Result / success */
.result-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.result-box h2 { margin: 0 0 6px; }
.order-code { font-size: 22px; font-weight: 800; color: var(--brand); letter-spacing: 1px; background: var(--bg-soft); border: 1px dashed var(--line); border-radius: 10px; padding: 12px 16px; display: inline-block; margin: 10px 0; }
.prompt-pre { white-space: pre-wrap; background: #0a0f1e; border: 1px solid var(--line); border-radius: 10px; padding: 16px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; max-height: 340px; overflow: auto; color: #cdd7ea; }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #16203a; border: 1px solid var(--line); color: var(--text); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); z-index: 80; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { border-color: #ff6b6b; }
.toast.ok { border-color: #38d39f; }

/* Misc */
.site-footer { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: 13px; text-align: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin: 18px 0 0; }
.back-link:hover { color: var(--text); }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.25); border-top-color: #201400; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ===================== Sticky Action Bar (EnTe AI) ===================== */
body.with-actionbar { padding-bottom: 76px; }
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  background: rgba(9, 13, 26, .93); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.action-bar .inner {
  width: min(1180px, 92vw); margin: 0 auto; height: 62px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ente-btn {
  display: inline-flex; align-items: center; gap: 11px; cursor: pointer; border: 0;
  background: linear-gradient(135deg, #6a3df0, #37a4ff); color: #fff;
  padding: 9px 18px 9px 12px; border-radius: 13px; text-align: left;
  box-shadow: 0 6px 22px rgba(106, 61, 240, .38); transition: filter .15s, transform .1s;
}
.ente-btn:hover { filter: brightness(1.07); }
.ente-btn:active { transform: translateY(1px); }
.ente-btn img { width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(0,0,0,.3)); }
.ente-btn b { display: block; font-size: 14px; font-weight: 700; line-height: 1.1; }
.ente-btn small { display: block; font-size: 10.5px; font-weight: 500; opacity: .85; }
.founder-link { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; font-weight: 600; }
.founder-link:hover { color: var(--text); }
.founder-link .dot { width: 8px; height: 8px; border-radius: 50%; background: #37a4ff; box-shadow: 0 0 9px #37a4ff; flex-shrink: 0; }
.ente-toast { bottom: 88px; }

/* ===================== EnTe AI chat widget ===================== */
.ente-panel {
  position: fixed; right: 18px; bottom: 84px; z-index: 75;
  width: min(370px, calc(100vw - 24px)); height: min(520px, calc(100vh - 160px));
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); display: none; flex-direction: column; overflow: hidden;
}
.ente-panel.open { display: flex; animation: entePop .18s ease; }
@keyframes entePop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ente-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: linear-gradient(135deg, #6a3df0, #37a4ff); color: #fff; }
.ente-head img { width: 30px; height: 30px; object-fit: contain; }
.ente-head-t b { display: block; font-size: 14.5px; line-height: 1.1; }
.ente-head-t small { font-size: 11px; opacity: .85; }
.ente-close { margin-left: auto; background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; line-height: 1; opacity: .9; }
.ente-close:hover { opacity: 1; }
.ente-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; background: var(--bg); }
.ente-b { max-width: 84%; padding: 9px 12px; border-radius: 13px; font-size: 13.7px; line-height: 1.5; white-space: normal; word-wrap: break-word; }
.ente-b.assistant { background: var(--card-2); color: var(--text); align-self: flex-start; border-top-left-radius: 4px; }
.ente-b.user { background: linear-gradient(135deg, #6a3df0, #37a4ff); color: #fff; align-self: flex-end; border-top-right-radius: 4px; }
.ente-typing { display: flex; gap: 4px; align-items: center; }
.ente-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: enteBlink 1s infinite; }
.ente-typing span:nth-child(2) { animation-delay: .2s; }
.ente-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes enteBlink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
.ente-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--card); }
.ente-input input { flex: 1; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 10px 12px; font-size: 14px; outline: none; }
.ente-input input:focus { border-color: #6a3df0; }
.ente-input button { width: 42px; border: 0; border-radius: 10px; background: linear-gradient(135deg, #6a3df0, #37a4ff); color: #fff; font-size: 16px; cursor: pointer; }
@media (max-width: 600px) { .ente-panel { right: 12px; left: 12px; width: auto; bottom: 78px; } }
@media (max-width: 600px) {
  .action-bar .inner { height: 58px; }
  .ente-btn small { display: none; }
  .ente-btn b { font-size: 13px; }
  .founder-link .txt { display: none; }
}
