:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ec;
  --text: #17211b;
  --muted: #68736d;
  --line: #d9e0da;
  --accent: #126f63;
  --accent-2: #e95236;
  --accent-3: #f0b429;
  --danger: #a93434;
  --shadow: 0 18px 50px rgba(31, 45, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 38px;
  line-height: 1.05;
}

h2 {
  font-size: 16px;
}

.status {
  min-width: 104px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.control-panel,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  position: sticky;
  top: 16px;
  padding: 16px;
}

.panel-head,
.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head span {
  min-width: 28px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

textarea {
  width: 100%;
  height: 210px;
  margin-top: 12px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: #fbfcfa;
  line-height: 1.55;
}

textarea:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(18, 111, 99, 0.28);
  outline-offset: 2px;
}

.field {
  margin-top: 14px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.segment,
.ghost-button,
.icon-button,
.primary-action,
select {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
}

.segment {
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--line);
}

select {
  width: 100%;
  padding: 0 12px;
  border-color: var(--line);
  background: #fbfcfa;
}

.primary-action {
  width: 100%;
  margin-top: 16px;
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 900;
}

.primary-action:disabled {
  opacity: 0.58;
  cursor: wait;
}

.history-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.icon-button {
  width: 36px;
  min-height: 32px;
  background: var(--surface-2);
  color: var(--text);
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  margin-top: 10px;
  overflow: auto;
}

.history-item {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  text-align: left;
}

.history-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.result-panel {
  min-height: calc(100vh - 132px);
  padding: 18px;
}

.result-toolbar {
  margin-bottom: 14px;
}

.result-toolbar p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.ghost-button {
  padding: 0 12px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.ghost-button:disabled {
  color: #a7afa9;
  cursor: not-allowed;
}

.visual-strip {
  height: 66px;
  display: grid;
  grid-template-columns: 2fr 1.2fr 0.85fr 1.6fr 0.65fr;
  gap: 8px;
  margin-bottom: 14px;
}

.visual-strip span {
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.5), transparent),
    var(--surface-2);
  border: 1px solid var(--line);
}

.visual-strip span:nth-child(1) { background-color: #d9eee7; }
.visual-strip span:nth-child(2) { background-color: #f9e6b4; }
.visual-strip span:nth-child(3) { background-color: #e9ddd2; }
.visual-strip span:nth-child(4) { background-color: #dce8f4; }
.visual-strip span:nth-child(5) { background-color: #f1d7cf; }

.results {
  display: grid;
  gap: 12px;
}

.empty-state,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.empty-state {
  min-height: 330px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.result-card {
  overflow: hidden;
}

.result-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.result-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 900;
}

.result-url,
.result-stats {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.badge {
  height: 26px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 14px 0;
}

.output {
  width: 100%;
  min-height: 280px;
  max-height: 620px;
  margin: 12px 14px 14px;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111a16;
  color: #f0f5ee;
  white-space: pre-wrap;
  line-height: 1.65;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.summary {
  margin: 12px 14px 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-2);
}

.summary div {
  margin: 5px 0;
  color: #2d3831;
  font-size: 13px;
}

.error-card {
  border-color: rgba(169, 52, 52, 0.35);
}

.error-card .badge {
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 180px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17211b;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 960px) {
  .shell {
    width: min(100vw - 20px, 720px);
    padding: 12px 0;
  }

  .topbar {
    min-height: 72px;
  }

  h1 {
    font-size: 30px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .result-toolbar,
  .result-head {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .toolbar-actions,
  .result-actions {
    justify-content: stretch;
  }

  .toolbar-actions button,
  .result-actions button {
    flex: 1 1 130px;
  }

  .visual-strip {
    height: 44px;
  }
}

/* Linear-inspired command workspace */
:root {
  color-scheme: dark;
  --bg: #08090a;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.055);
  --surface-3: #191a1b;
  --text: #f7f8f8;
  --muted: #8a8f98;
  --muted-2: #62666d;
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.05);
  --accent: #7170ff;
  --accent-strong: #5e6ad2;
  --accent-hover: #828fff;
  --danger: #ff6b6b;
  --success: #10b981;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body {
  background:
    linear-gradient(180deg, rgba(113, 112, 255, 0.09) 0, rgba(8, 9, 10, 0) 320px),
    var(--bg);
  color: var(--text);
  font-feature-settings: "cv01", "ss03";
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 58%);
}

.shell {
  width: min(1640px, calc(100vw - 48px));
  padding: 32px 0;
}

.topbar {
  min-height: 76px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 18px;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(113, 112, 255, 0.95), rgba(130, 143, 255, 0.58)),
    #111217;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 12px 30px rgba(94, 106, 210, 0.26);
}

.brand-mark::after {
  content: "";
  display: block;
  width: 14px;
  height: 18px;
  margin: 9px auto;
  border-left: 2px solid #fff;
  border-right: 2px solid rgba(255, 255, 255, 0.72);
  transform: skew(-10deg);
}

.eyebrow {
  color: var(--accent-hover);
  font-size: 12px;
  font-weight: 510;
}

h1 {
  margin-top: 2px;
  font-size: 32px;
  line-height: 1.08;
  font-weight: 510;
}

h2 {
  color: var(--text);
  font-size: 15px;
  font-weight: 590;
}

.status {
  height: 34px;
  min-width: 112px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 999px;
  color: #d0d6e0;
  font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

.control-panel,
.result-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.022));
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.control-panel {
  top: 18px;
  padding: 16px;
}

.panel-head span {
  min-width: 30px;
  height: 24px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.05);
  color: #d0d6e0;
  border-radius: 7px;
  font-weight: 510;
}

textarea,
select {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: #d0d6e0;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

textarea {
  height: 248px;
  padding: 14px;
  line-height: 1.58;
  font-size: 14px;
}

textarea::placeholder {
  color: var(--muted-2);
}

textarea:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(113, 112, 255, 0.28);
  outline-offset: 2px;
  border-color: rgba(130, 143, 255, 0.48);
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 510;
}

.segmented {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 8px;
}

.segment,
.ghost-button,
.icon-button,
.primary-action,
select {
  min-height: 40px;
  border-radius: 7px;
}

.segment {
  color: var(--muted);
  font-weight: 510;
}

.segment.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.075);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

select {
  border-color: var(--line);
  background-color: rgba(255, 255, 255, 0.025);
}

.primary-action {
  min-height: 44px;
  margin-top: 18px;
  border-color: rgba(130, 143, 255, 0.62);
  background: linear-gradient(180deg, var(--accent-hover), var(--accent-strong));
  color: #fff;
  font-weight: 590;
  box-shadow: 0 14px 34px rgba(94, 106, 210, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.primary-action:hover {
  filter: brightness(1.05);
}

.history-panel {
  border-top-color: var(--line-soft);
}

.icon-button,
.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: #d0d6e0;
  font-weight: 510;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.ghost-button:hover,
.icon-button:hover,
.history-item:hover {
  background: rgba(255, 255, 255, 0.065);
  color: var(--text);
}

.history-item {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
}

.history-title {
  font-weight: 510;
}

.history-meta,
.result-toolbar p,
.result-url,
.result-stats {
  color: var(--muted);
}

.result-panel {
  min-height: calc(100vh - 150px);
  padding: 18px;
}

.result-toolbar {
  min-height: 54px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.ghost-button:disabled {
  color: var(--muted-2);
  opacity: 0.62;
}

.empty-state {
  min-height: calc(100vh - 250px);
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  color: var(--muted);
  font-size: 15px;
}

.result-card {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.result-head {
  border-bottom-color: var(--line-soft);
}

.result-title {
  color: var(--text);
  font-weight: 590;
}

.badge {
  border: 1px solid rgba(113, 112, 255, 0.34);
  background: rgba(113, 112, 255, 0.12);
  color: #c5c8ff;
  border-radius: 999px;
  font-weight: 510;
}

.summary {
  background: rgba(113, 112, 255, 0.08);
  border: 1px solid rgba(113, 112, 255, 0.18);
}

.summary div {
  color: #d0d6e0;
}

.output {
  width: calc(100% - 28px);
  border-color: var(--line);
  background: #0b0c0e;
  color: #e5e7eb;
  font-family: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.error-card {
  border-color: rgba(255, 107, 107, 0.32);
}

.error-card .badge {
  border-color: rgba(255, 107, 107, 0.32);
  background: rgba(255, 107, 107, 0.1);
  color: #ffb4b4;
}

.toast {
  right: 22px;
  bottom: 22px;
  border: 1px solid var(--line);
  background: rgba(15, 16, 17, 0.94);
  color: var(--text);
  border-radius: 10px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.54), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}

@media (max-width: 960px) {
  .shell {
    width: min(100vw - 20px, 720px);
    padding: 14px 0;
  }

  .topbar {
    min-height: 66px;
    align-items: flex-start;
    padding-bottom: 14px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .brand-mark::after {
    width: 11px;
    height: 15px;
    margin-top: 8px;
  }

  h1 {
    font-size: 27px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  textarea {
    height: 210px;
  }

  .result-panel {
    min-height: 560px;
  }

  .empty-state {
    min-height: 360px;
  }
}
