:root {
  --bg: #08090b;
  --bg-soft: #0d1014;
  --bg-elev: #12161c;
  --bg-elev2: #171d24;
  --border: #27313a;
  --border-light: #3b4753;
  --text: #e6e9ed;
  --text-muted: #9aa4ad;
  --text-dim: #66717b;
  --accent: #a3e635;
  --accent-strong: #84cc16;
  --accent2: #38bdf8;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; background: var(--bg); scroll-behavior: smooth; }
body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(163, 230, 53, 0.055), transparent 300px),
    var(--bg);
  color: var(--text);
  font: 14px/1.6 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
::selection { background: rgba(163, 230, 53, 0.22); }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.shell { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.shell-narrow { max-width: 720px; }
.shell-mid { max-width: 960px; }

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 9, 11, 0.86);
  backdrop-filter: blur(14px);
}
.nav-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.nav-links { display: flex; gap: 22px; color: var(--text-muted); font-size: 14px; font-weight: 600; }
.nav-links a { transition: color var(--transition); }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; gap: 10px; align-items: center; }

.btn {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-primary {
  border-color: rgba(163, 230, 53, 0.5);
  background: linear-gradient(180deg, #b6f04a, #78b80f);
  color: #111705;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(132, 204, 22, 0.22); }
.btn-secondary { border-color: var(--border); background: var(--bg-elev); color: var(--text); }
.btn-secondary:hover { border-color: var(--border-light); background: var(--bg-elev2); }
.btn-muted { border-color: var(--border); background: transparent; color: var(--text-muted); }
.btn-muted:hover { color: var(--text); border-color: var(--border-light); }
.btn:disabled, input:disabled, textarea:disabled { cursor: not-allowed; opacity: 0.55; }
.icon-btn { width: 44px; min-width: 44px; padding: 0; }
.icon-btn[data-active="true"] { border-color: rgba(163, 230, 53, 0.55); background: rgba(163, 230, 53, 0.12); color: var(--accent); }
.btn[data-copied="true"] { border-color: rgba(34, 197, 94, 0.65); background: linear-gradient(180deg, #86efac, #22c55e); color: #052e16; }
.btn[data-busy="true"] { opacity: 0.72; pointer-events: none; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  font-size: 12px;
  font-weight: 600;
}
.kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 28px;
  align-items: end;
  padding: 40px 0 20px;
}
.hero-copy { min-width: 0; }
.hero h1 {
  max-width: 620px;
  margin: 10px 0 12px;
  font-size: clamp(36px, 5.2vw, 52px);
  font-weight: 850;
  line-height: 1.04;
  text-wrap: balance;
}
.hero .lede { max-width: 560px; color: var(--text-muted); font-size: 16px; line-height: 1.55; }
.hero-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.command-box {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-soft));
  box-shadow: var(--shadow);
}
.command-box .kicker { display: block; margin-bottom: 10px; }
.command-box code,
.command {
  color: var(--accent);
  font-family: "SF Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  overflow-wrap: anywhere;
}
.command-box .lede { margin-top: 10px; font-size: 13px; color: var(--text-muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 0 0 22px; }
.stat {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.stat strong { display: block; color: var(--accent); font-size: 26px; font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-muted); font-size: 12px; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 24px; font-weight: 800; line-height: 1.2; }
.section-head p { color: var(--text-muted); max-width: 560px; }
.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 160px 160px; gap: 10px; margin-bottom: 14px; }
.search {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  transition: border-color var(--transition), background-color var(--transition), box-shadow var(--transition);
}
.search:hover, .search:focus-visible { border-color: var(--border-light); background: var(--bg-elev2); }
.search::placeholder { color: var(--text-dim); }
select.search { cursor: pointer; }

.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.catalog[data-empty="true"]::after {
  content: "No matching tasks.";
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  background: var(--bg-elev);
}
.task-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: border-color var(--transition), background-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.task-card:hover { border-color: var(--border-light); background: var(--bg-elev2); transform: translateY(-1px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25); }
.task-card .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.task-card h2 { font-size: 19px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.desc { color: var(--text-muted); font-size: 13px; line-height: 1.6; min-height: 2lh; overflow-wrap: anywhere; }
.metric-row { display: flex; gap: 18px; padding-top: 10px; border-top: 1px solid var(--border); }
.metric { display: flex; flex-direction: column; gap: 1px; }
.metric b { color: var(--text); font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.metric span { color: var(--text-dim); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.install-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.install-row .command {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-actions .btn-download { margin-right: auto; }

.page-head { padding: 44px 0 24px; }
.page-head h1 { margin: 10px 0 8px; font-size: clamp(34px, 6vw, 44px); font-weight: 850; line-height: 1.1; text-wrap: balance; }
.page-head .lede { color: var(--text-muted); font-size: 16px; max-width: 620px; }
.panel {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.panel h2 { margin-bottom: 16px; font-size: 22px; font-weight: 800; }
.panel h3 { margin: 22px 0 10px; font-size: 16px; font-weight: 750; }
.panel h3:first-child { margin-top: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.submission-row {
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.submission-row strong { display: block; margin-bottom: 4px; color: var(--text); overflow-wrap: anywhere; }
.submission-row p, .submission-row span { color: var(--text-muted); overflow-wrap: anywhere; }
.submission-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.submission-actions .btn { min-height: 40px; padding: 0 14px; font-size: 13px; }
.notice { border-left: 3px solid var(--accent); padding: 8px 0 8px 12px; color: var(--text-muted); }
.empty { grid-column: 1 / -1; padding: 24px 0; color: var(--text-muted); text-align: center; }
.empty a, .notice a, .result a { color: var(--accent); font-weight: 700; }
.empty-state { display: grid; gap: 12px; align-content: start; max-width: 520px; }
.empty-state p { color: var(--text-muted); }
.empty-state .btn { justify-self: start; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field label { color: var(--text-muted); font-size: 13px; font-weight: 650; }
.field input, .field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition), background-color var(--transition), box-shadow var(--transition);
}
.field textarea { min-height: 108px; padding: 12px 13px; resize: vertical; }
.field input:hover, .field textarea:hover,
.field input:focus-visible, .field textarea:focus-visible { border-color: var(--border-light); background: #0a0d11; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-dim); }
.required-files {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.required-files strong { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 13px; }
.required-files ul { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; }
.required-files li { padding: 3px 7px; border-radius: 4px; background: var(--bg-elev); color: var(--accent); font-family: "SF Mono", Consolas, ui-monospace, monospace; font-size: 12px; }
.file-field input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.file-drop {
  min-height: 86px;
  padding: 16px;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
}
.file-drop strong { display: block; color: var(--text); }
.file-drop span { overflow-wrap: anywhere; }
.file-drop .btn { pointer-events: none; }
.submit-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.result { min-height: 24px; color: var(--text-muted); }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid rgba(163, 230, 53, 0.45);
  border-radius: var(--radius);
  background: var(--bg-elev2);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition);
}
.toast[data-show="true"] { opacity: 1; transform: translateY(0); }
.toast[data-type="error"] { border-color: rgba(239, 68, 68, 0.65); }

.ugk-dialog {
  width: min(520px, calc(100vw - 32px));
  margin: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0;
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow);
}
.ugk-dialog::backdrop { background: rgba(0, 0, 0, 0.68); }
.dialog-card { display: grid; gap: 12px; padding: 20px; }
.dialog-card h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.dialog-card p { color: var(--text-muted); }
.dialog-card textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.footer { margin-top: 56px; padding: 28px 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.footer strong { font-size: 16px; }
.footer p { color: var(--text-muted); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
@media (max-width: 840px) {
  .hero { grid-template-columns: 1fr; padding-top: 36px; }
  .toolbar { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .shell { padding: 0 18px; }
  .nav-inner { min-height: 58px; flex-wrap: wrap; padding: 10px 0; gap: 10px; }
  .nav-links { order: 3; width: 100%; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
  .nav-links a { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-soft); }
  .nav-actions .chip[data-user] { display: none; }
  .hero { padding: 26px 0 16px; }
  .hero h1 { font-size: 30px; }
  .hero .lede { font-size: 15px; }
  .hero-actions { margin-top: 16px; }
  .command-box { display: none; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 7px; padding-bottom: 18px; }
  .stat { padding: 8px; }
  .stat strong { font-size: 20px; }
  .stat span { font-size: 10px; }
  .catalog { grid-template-columns: 1fr; }
  .split, .form-grid { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
}
@media (max-width: 480px) {
  .toast { right: 16px; bottom: 16px; }
  .install-row { grid-template-columns: 1fr; }
  .install-row .btn { width: 100%; }
  .card-actions .btn-download { width: 100%; margin-right: 0; }
  .file-drop { align-items: stretch; flex-direction: column; }
}
