:root {
  color-scheme: dark;
  --bg: #0b0f12;
  --panel: #11171b;
  --panel-strong: #151d22;
  --line: #263138;
  --muted: #90a0aa;
  --text: #eff7f4;
  --accent: #55f0b1;
  --accent-strong: #12bf7a;
  --accent-ink: #052c1f;
  --amber: #ffca66;
  --danger: #ff7c7c;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% -10%, rgba(85, 240, 177, 0.16), transparent 34rem),
    radial-gradient(circle at 95% 18%, rgba(35, 115, 238, 0.12), transparent 32rem),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 14px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(11, 15, 18, 0.84);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(85, 240, 177, 0.6);
  border-radius: 13px;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 0 28px rgba(85, 240, 177, 0.16);
  font-size: 24px;
  font-weight: 900;
}

h1,
h2,
p {
  margin-top: 0;
}

.brand h1 {
  margin: 1px 0 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.top-actions,
.category-row,
.script-actions,
.report-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: #43535d;
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.button-primary,
.button-download {
  border-color: transparent;
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 800;
}

.button-primary:hover,
.button-download:hover {
  background: #76f7c3;
}

.button-quiet {
  background: transparent;
}

main {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 46px 0 72px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  padding: 28px 0 34px;
}

.hero h2 {
  max-width: 840px;
  margin-bottom: 18px;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 0.99;
  letter-spacing: -0.055em;
}

.hero-copy {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats article {
  min-height: 110px;
  padding: 22px 24px;
  border-right: 1px solid var(--line);
}

.stats article:last-child {
  border-right: 0;
}

.stats span,
.scope-select span {
  display: block;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.stats strong {
  font-size: 29px;
  line-height: 1;
}

.stats .status-text {
  color: var(--accent);
  font-size: 20px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
}

.library-panel,
.update-card,
.guide-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(17, 23, 27, 0.92);
  box-shadow: var(--shadow);
}

.library-panel {
  min-width: 0;
  padding: 28px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2,
.update-card h2,
.guide-card h2 {
  margin-bottom: 0;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.section-heading.compact {
  align-items: center;
}

.scope-select select {
  min-width: 128px;
  padding: 9px 32px 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--panel-strong);
}

.search-box {
  position: relative;
  display: block;
  margin: 25px 0 18px;
}

.search-box input {
  width: 100%;
  height: 54px;
  padding: 0 52px 0 17px;
  border: 1px solid var(--line);
  outline: 0;
  border-radius: 13px;
  color: var(--text);
  background: #0d1317;
  font-size: 16px;
}

.search-box input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(85, 240, 177, 0.08);
}

kbd {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--panel);
  font: inherit;
}

.category-row {
  flex-wrap: wrap;
}

.chip {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.chip.active {
  border-color: rgba(85, 240, 177, 0.4);
  color: var(--accent);
  background: rgba(85, 240, 177, 0.08);
}

.selection-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 10px;
}

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

.result-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.button-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.script-list {
  display: grid;
  gap: 10px;
}

.script-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 17px 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: var(--panel-strong);
  transition: border-color 150ms ease;
}

.script-item:hover,
.script-item.selected {
  border-color: #34434b;
}

.script-item.selected {
  background: rgba(85, 240, 177, 0.06);
}

.script-check {
  position: relative;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  cursor: pointer;
}

.script-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.script-check span {
  width: 18px;
  height: 18px;
  border: 1px solid #526069;
  border-radius: 5px;
  background: var(--panel);
}

.script-check input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 4px #10231d;
}

.script-check input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.script-name {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 800;
}

.script-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(85, 240, 177, 0.08);
}

.badge.history {
  color: var(--amber);
  background: rgba(255, 202, 102, 0.09);
}

.badge.invalid {
  color: var(--danger);
  background: rgba(255, 124, 124, 0.09);
}

.download-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.damage-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(85, 240, 177, 0.25);
  border-radius: 9px;
  color: var(--accent);
  background: rgba(85, 240, 177, 0.05);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.damage-link:hover {
  border-color: var(--accent);
  background: rgba(85, 240, 177, 0.09);
}

.download-link:hover {
  border-color: var(--accent-strong);
  color: var(--accent);
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.update-card,
.guide-card {
  padding: 24px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 5px rgba(144, 160, 170, 0.08);
}

.dot.ok {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(85, 240, 177, 0.08);
}

.dot.warn {
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(255, 202, 102, 0.09);
}

dl {
  margin: 24px 0;
}

dl div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  text-align: right;
  font-size: 13px;
}

code {
  color: var(--accent);
}

.report-links {
  align-items: start;
  flex-direction: column;
}

.report-links a,
.guide-card > a {
  font-size: 13px;
  text-decoration: none;
}

.guide-card ol {
  margin: 20px 0 22px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.guide-card li + li {
  margin-top: 8px;
}

.empty-state {
  padding: 58px 20px;
  text-align: center;
}

.empty-state span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 420px;
  padding: 14px 17px;
  transform: translateY(22px);
  border: 1px solid var(--line);
  border-radius: 12px;
  opacity: 0;
  color: var(--text);
  background: #172127;
  box-shadow: var(--shadow);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .topbar {
    position: static;
    align-items: start;
    flex-direction: column;
    gap: 14px;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .button {
    flex: 1;
  }

  main {
    width: min(100% - 24px, 1480px);
    padding-top: 24px;
  }

  .hero h2 {
    font-size: 39px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats article:nth-child(2) {
    border-right: 0;
  }

  .stats article:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .library-panel {
    padding: 20px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .selection-bar,
  .selection-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .script-item {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
  }

  .script-actions {
    grid-column: 1 / -1;
  }

  .script-actions,
  .download-link {
    width: 100%;
  }
}


/* Compact personal dashboard */
.topbar {
  min-height: 60px;
  padding: 8px clamp(16px, 3vw, 32px);
}

.brand {
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 19px;
}

.brand .eyebrow {
  display: none;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
}

.top-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-status {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: rgba(17, 23, 27, 0.82);
  font-size: 12px;
  white-space: nowrap;
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #61717a;
}

.action-status[data-state="loading"] {
  border-color: rgba(255, 202, 102, 0.4);
  color: var(--amber);
}

.action-status[data-state="loading"] .status-indicator {
  background: var(--amber);
  animation: status-pulse 900ms ease-in-out infinite alternate;
}

.action-status[data-state="success"] {
  border-color: rgba(85, 240, 177, 0.35);
  color: var(--accent);
}

.action-status[data-state="success"] .status-indicator {
  background: var(--accent);
}

.action-status[data-state="error"] {
  border-color: rgba(255, 124, 124, 0.4);
  color: var(--danger);
}

.action-status[data-state="error"] .status-indicator {
  background: var(--danger);
}

@keyframes status-pulse {
  to { opacity: 0.35; }
}

.button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13px;
}

.button.loading::before {
  width: 12px;
  height: 12px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: button-spin 700ms linear infinite;
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}

main {
  width: min(1360px, calc(100% - 32px));
  padding: 18px 0 42px;
}

.hero {
  align-items: center;
  gap: 20px;
  padding: 4px 0 14px;
}

.hero h2 {
  max-width: none;
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.hero-copy {
  font-size: 14px;
  line-height: 1.5;
}

.stats {
  margin-bottom: 14px;
  border-radius: 12px;
  box-shadow: none;
}

.stats article {
  min-height: 68px;
  padding: 11px 16px;
}

.stats span,
.scope-select span {
  margin-bottom: 6px;
  font-size: 11px;
}

.stats strong {
  font-size: 22px;
}

.stats .status-text {
  font-size: 16px;
}

.workspace {
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
}

.library-panel,
.update-card,
.guide-card {
  border-radius: 14px;
  box-shadow: none;
}

.library-panel {
  padding: 18px;
}

.section-heading h2,
.update-card h2,
.guide-card h2 {
  font-size: 19px;
}

.scope-select select {
  padding-top: 7px;
  padding-bottom: 7px;
}

.search-box {
  margin: 14px 0 12px;
}

.search-box input {
  height: 42px;
  border-radius: 10px;
  font-size: 14px;
}

kbd {
  top: 8px;
}

.chip {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.selection-bar {
  margin: 12px 0 8px;
}

.button-small {
  min-height: 32px;
}

.script-list {
  gap: 8px;
}

.script-item {
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
}

.script-name {
  margin-bottom: 6px;
  font-size: 14px;
}

.badge {
  padding: 3px 7px;
}

.download-link {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.side-panel {
  gap: 12px;
}

.update-card,
.guide-card {
  padding: 16px;
}

dl {
  margin: 14px 0;
}

dl div {
  padding: 9px 0;
}

.guide-card ol {
  margin: 14px 0 16px;
  line-height: 1.55;
}

.guide-card li + li {
  margin-top: 5px;
}

.toast {
  top: 70px;
  right: 18px;
  bottom: auto;
  padding: 11px 14px;
}

.toast[data-state="success"] {
  border-color: rgba(85, 240, 177, 0.4);
}

.toast[data-state="error"] {
  border-color: rgba(255, 124, 124, 0.45);
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .topbar {
    gap: 8px;
    padding: 10px 12px;
  }

  .top-tools {
    width: 100%;
    align-items: stretch;
    flex-wrap: wrap;
  }

  .action-status {
    flex: 1 1 100%;
  }

  main {
    width: calc(100% - 20px);
    padding-top: 12px;
  }

  .hero {
    gap: 10px;
    padding-bottom: 12px;
  }

  .hero h2 {
    font-size: 23px;
  }

  .hero .button-download {
    align-self: stretch;
  }

  .stats article {
    min-height: 62px;
    padding: 10px 12px;
  }

  .library-panel {
    padding: 14px;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .toast {
    top: 12px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}
.script-notes {
  margin: -1px 0 7px;
  color: var(--muted);
  font-size: 12px;
}

.script-notes summary {
  width: fit-content;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
}

.script-notes p {
  max-width: 760px;
  margin: 7px 0 0;
  padding: 8px 10px;
  border-left: 2px solid rgba(85, 240, 177, 0.35);
  border-radius: 0 7px 7px 0;
  background: rgba(85, 240, 177, 0.04);
  line-height: 1.55;
}