:root {
  color-scheme: dark;
  --ink: #11120f;
  --panel: #181a16;
  --panel-2: #20221d;
  --line: #3a3d33;
  --paper: #eee9dc;
  --muted: #999b8d;
  --acid: #c8f24b;
  --ember: #ff7547;
  --amber: #eebd4a;
  --danger: #ff625e;
  --radius: 3px;
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--paper); background: var(--ink); }
button, input, select { font: inherit; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .08; z-index: 10; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E"); }

.masthead { min-height: 86px; padding: 18px clamp(20px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(17,18,15,.94); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; color: var(--ink); background: var(--acid); font: 900 20px/1 "Courier New", monospace; transform: rotate(-3deg); }
.brand p { margin: 0 0 4px; color: var(--muted); font: 700 10px/1 "Courier New", monospace; letter-spacing: .16em; }
.brand h1 { margin: 0; font: 800 23px/1 "Songti SC", "SimSun", serif; letter-spacing: .16em; }
.system-status { display: flex; align-items: center; gap: 25px; }
.system-status > div { display: grid; gap: 4px; min-width: 72px; }
.system-status small { color: var(--muted); font-size: 10px; }
.system-status strong { font: 700 12px/1 "Courier New", monospace; }
.admin-entry { color: var(--muted); border-bottom: 1px solid #55594a; padding-bottom: 3px; font: 700 10px/1 "Courier New", monospace; letter-spacing: .08em; text-decoration: none; transition: color .2s, border-color .2s; }
.admin-entry:hover, .admin-entry:focus-visible { color: var(--acid); border-color: var(--acid); }
.signal { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 5px rgba(238,189,74,.12); }
.signal.ok { background: var(--acid); box-shadow: 0 0 0 5px rgba(200,242,75,.12), 0 0 18px rgba(200,242,75,.45); }
.signal.bad { background: var(--danger); }

main { width: min(1540px, 94vw); margin: 0 auto 80px; }
.hero { display: grid; grid-template-columns: minmax(440px, 1.3fr) minmax(260px, .7fr); gap: 50px; align-items: end; min-height: 310px; padding: 54px 0 46px; border-bottom: 1px solid var(--line); }
.eyebrow, .plate { color: var(--acid); font: 700 11px/1 "Courier New", monospace; letter-spacing: .18em; }
.hero h2 { margin: 17px 0 0; font: 800 clamp(38px, 5.6vw, 78px)/1.04 "Songti SC", "SimSun", serif; letter-spacing: -.05em; }
.hero h2 em { color: var(--acid); font-style: normal; }
.hero > p { margin: 0; padding-left: 22px; border-left: 4px solid var(--ember); color: #c2c0b5; font-size: 14px; line-height: 1.9; }

.workspace { display: grid; grid-template-columns: minmax(240px, .64fr) minmax(560px, 1.65fr) minmax(300px, .85fr); gap: 1px; margin-top: 42px; background: var(--line); border: 1px solid var(--line); }
.panel { min-width: 0; padding: 25px; background: var(--panel); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.panel-heading > div, .auth-panel > div { display: flex; align-items: center; gap: 12px; }
.panel h3, .auth-panel h3 { margin: 0; font: 800 20px/1 "Songti SC", "SimSun", serif; letter-spacing: .08em; }
.step-no { color: var(--ember); font: 700 12px/1 "Courier New", monospace; }
.counter { color: var(--muted); font: 700 11px/1 "Courier New", monospace; }
.panel-note { min-height: 66px; margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.source-lockup { display: flex; align-items: center; gap: 13px; min-height: 76px; margin: 16px 0 18px; padding: 14px; border: 1px solid var(--line); background: repeating-linear-gradient(-45deg, rgba(200,242,75,.035) 0 2px, transparent 2px 8px), #11130f; }
.source-lockup-mark { display: grid; place-items: center; width: 42px; height: 42px; color: var(--ink); background: var(--acid); font: 900 11px/1 "Courier New", monospace; transform: rotate(-4deg); }
.source-lockup div { display: grid; gap: 5px; }
.source-lockup strong { color: var(--paper); font-size: 13px; }
.source-lockup small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.quiet-admin-link { display: flex; align-items: center; justify-content: space-between; color: var(--amber); border-top: 1px dashed #45483c; padding-top: 14px; font: 700 10px/1.4 "Courier New", monospace; text-decoration: none; }
.quiet-admin-link span { color: var(--acid); font-size: 15px; }
.quiet-admin-link:hover { color: var(--acid); }

form { display: grid; gap: 24px; }
fieldset { margin: 0; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); }
legend { padding-right: 14px; color: var(--amber); font: 700 11px/1 "Courier New", monospace; letter-spacing: .14em; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.compact-form { gap: 15px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 11px; }
input, select { width: 100%; min-height: 43px; padding: 10px 12px; color: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); outline: none; background: #10110f; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { border-color: var(--acid); box-shadow: 0 0 0 3px rgba(200,242,75,.09); }
.wide { grid-column: span 2; }
.file-field { position: relative; }
.file-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-field b { display: flex; align-items: center; min-height: 43px; padding: 10px 12px; overflow: hidden; color: var(--paper); border: 1px dashed #55594a; background: #10110f; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.file-field b::before { content: "+"; margin-right: 9px; color: var(--acid); font: 700 18px/1 "Courier New", monospace; }
.upload-status { min-height: 16px; margin: -3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.upload-status.error { color: var(--danger); }
.upload-progress { height: 5px; overflow: hidden; background: #10110f; border: 1px solid var(--line); }
.upload-progress span { display: block; width: 0; height: 100%; background: var(--acid); transition: width .15s ease; }
.network-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.check { display: block; }
.check input { position: absolute; opacity: 0; }
.check span { display: block; padding: 9px 13px; color: var(--muted); border: 1px solid var(--line); cursor: pointer; }
.check input:checked + span { color: var(--ink); border-color: var(--acid); background: var(--acid); font-weight: 700; }
.ad-identity { display: grid; grid-template-columns: minmax(170px, .65fr) minmax(360px, 1.7fr); gap: 18px; margin: 22px 0 20px; padding: 18px; border: 1px solid rgba(200,242,75,.5); background: linear-gradient(115deg, rgba(200,242,75,.1), rgba(200,242,75,.025) 55%, transparent); box-shadow: inset 3px 0 0 var(--acid); }
.ad-identity-heading { display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.ad-identity-heading > span, .ad-placement-heading > span { color: var(--acid); font: 700 9px/1 "Courier New", monospace; letter-spacing: .16em; }
.ad-identity-heading strong { color: var(--paper); font: 800 16px/1.2 "Songti SC", "SimSun", serif; letter-spacing: .08em; }
.ad-identity-heading small { color: var(--muted); font-size: 10px; line-height: 1.6; }
.ad-identity-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ad-identity-fields label { color: var(--acid); font: 700 10px/1 "Courier New", monospace; letter-spacing: .08em; }
.ad-identity-fields input { min-height: 49px; border-color: rgba(200,242,75,.4); background: rgba(10,12,8,.72); font: 600 13px/1 "Courier New", monospace; }
.ad-identity-fields input:focus { border-color: var(--acid); }
.ad-placement-heading { display: flex; align-items: baseline; gap: 12px; margin: 0 0 12px; padding-bottom: 9px; border-bottom: 1px dashed #45483c; }
.ad-placement-heading small { color: var(--muted); font-size: 10px; }
.ad-grid input::placeholder, .ad-identity input::placeholder { color: #66695c; font-size: 10px; font-weight: 400; }
.auto-signing-note { display: flex; align-items: center; gap: 16px; padding: 15px 17px; border: 1px solid rgba(238,189,74,.42); background: rgba(238,189,74,.07); }
.auto-signing-note > span { flex: 0 0 auto; color: var(--amber); font: 700 9px/1 "Courier New", monospace; letter-spacing: .15em; }
.auto-signing-note > div { display: grid; gap: 4px; }
.auto-signing-note strong { color: var(--paper); font-size: 12px; }
.auto-signing-note small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.submit-row p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.submit-row p span { display: block; color: var(--paper); }
.button { min-height: 44px; padding: 10px 18px; border: 0; border-radius: var(--radius); cursor: pointer; transition: transform .15s, filter .15s; }
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button:disabled { opacity: .5; cursor: wait; }
.button.primary { min-width: 155px; color: var(--ink); background: var(--acid); text-align: left; }
.button.primary span { display: block; font-weight: 900; }
.button.primary small { font: 700 9px/1 "Courier New", monospace; letter-spacing: .14em; }
.button.secondary { color: var(--paper); border: 1px solid #5b604e; background: transparent; }
.icon-button { width: 34px; height: 34px; color: var(--acid); border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 20px; }

.job-list { display: grid; gap: 10px; }
.job { padding: 14px; border: 1px solid var(--line); background: var(--panel-2); }
.job.polling { border-color: rgba(238,189,74,.48); box-shadow: inset 2px 0 0 var(--amber); }
.job-top { display: flex; justify-content: space-between; gap: 10px; }
.job h4 { margin: 0; font-size: 13px; }
.job code { color: var(--muted); font: 10px/1 "Courier New", monospace; }
.job-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.job-duration { color: var(--amber); font-weight: 700; }
.job:not(.polling) .job-duration { color: var(--paper); }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--amber); font: 700 10px/1 "Courier New", monospace; text-transform: uppercase; }
.status.succeeded { color: var(--acid); }
.status.failed { color: var(--danger); }
.loading-spinner { width: 13px; height: 13px; border: 2px solid rgba(238,189,74,.28); border-top-color: var(--amber); border-radius: 50%; animation: job-loading-spin .8s linear infinite; }
@keyframes job-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-spinner { animation: none; } }
.job-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.job-actions button { color: var(--ink); border: 0; background: var(--acid); padding: 7px 10px; font-size: 11px; font-weight: 700; cursor: pointer; }
.job-actions button.secondary { color: var(--paper); border: 1px solid #5b604e; background: transparent; }
.empty-state { min-height: 190px; display: grid; place-content: center; gap: 7px; text-align: center; color: var(--muted); }
.empty-state b { color: var(--paper); font: 700 15px/1 "Songti SC", serif; }
.empty-state span { font-size: 10px; }

.auth-panel { margin: 30px auto 0; padding: 20px; display: grid; grid-template-columns: auto minmax(220px, 440px) auto; align-items: end; gap: 20px; border: 1px solid var(--amber); background: #211d13; }
.hidden { display: none !important; }
.toast { position: fixed; right: 28px; bottom: 28px; z-index: 20; max-width: 440px; padding: 14px 18px; color: var(--ink); background: var(--paper); box-shadow: 0 15px 50px rgba(0,0,0,.35); transform: translateY(120px); opacity: 0; transition: .25s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { color: white; background: var(--danger); }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr 2fr; }
  .jobs-panel { grid-column: 1 / -1; }
  .job-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .masthead { position: static; align-items: flex-start; }
  .system-status > div:not(:first-of-type) { display: none; }
  .system-status { gap: 12px; }
  .admin-entry { font-size: 9px; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 45px 0 35px; }
  .hero h2 { font-size: 42px; }
  .workspace { grid-template-columns: 1fr; }
  .jobs-panel { grid-column: auto; }
  .form-grid, .job-list { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .ad-grid { grid-template-columns: 1fr 1fr; }
  .ad-identity { grid-template-columns: 1fr; }
  .auth-panel { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  main { width: 92vw; }
  .panel { padding: 20px 16px; }
  .ad-grid, .ad-identity-fields { grid-template-columns: 1fr; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .button.primary { width: 100%; }
}
