:root {
  --bg: #16110d;
  --bg-layer: linear-gradient(135deg, rgba(255, 146, 39, 0.12), transparent 42%),
    linear-gradient(315deg, rgba(255, 96, 0, 0.1), transparent 36%),
    radial-gradient(circle at top right, rgba(255, 168, 76, 0.18), transparent 24%),
    #16110d;
  --panel: rgba(35, 24, 17, 0.9);
  --panel-strong: #2d1d13;
  --panel-soft: rgba(52, 35, 24, 0.9);
  --text: #f6eadc;
  --muted: #c8b29f;
  --line: rgba(255, 162, 74, 0.2);
  --line-strong: rgba(255, 162, 74, 0.45);
  --accent: #ff8a2a;
  --accent-strong: #ff6a00;
  --accent-soft: #ffb25a;
  --success: #ffbf66;
  --error: #ff7a59;
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.34);
  --inner-shadow: inset 0 1px 0 rgba(255, 196, 132, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: #120d09;
}

body {
  margin: 0;
  font-family: Consolas, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 148, 52, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 148, 52, 0.035) 1px, transparent 1px),
    var(--bg-layer);
  background-size: 24px 24px, 24px 24px, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 136, 42, 0.03), transparent 18%, transparent 82%, rgba(255, 136, 42, 0.03)),
    linear-gradient(rgba(255, 140, 0, 0.02), transparent 28%, transparent 72%, rgba(255, 140, 0, 0.02));
}

.page-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: relative;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(41, 28, 18, 0.98), rgba(23, 16, 11, 0.98));
  box-shadow: inset -1px 0 0 rgba(255, 176, 94, 0.08);
}

.sidebar::after {
  content: "";
  position: absolute;
  top: 18px;
  right: 18px;
  bottom: 18px;
  left: 18px;
  border: 1px solid rgba(255, 166, 77, 0.08);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  pointer-events: none;
}

.brand {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  margin-bottom: 28px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(67, 42, 25, 0.88), rgba(39, 25, 16, 0.88));
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  box-shadow: var(--shadow), var(--inner-shadow);
}

.brand strong {
  display: block;
  font-size: 1.02rem;
  letter-spacing: 0.04em;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 189, 118, 0.5);
  clip-path: polygon(18% 0, 100% 0, 100% 82%, 82% 100%, 0 100%, 0 18%);
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 222, 178, 0.22), transparent 28%),
    linear-gradient(135deg, #ff8a2a, #a74200);
  color: #fff8f0;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 0 24px rgba(255, 112, 24, 0.24);
}

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

.nav a {
  position: relative;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  background: linear-gradient(180deg, rgba(55, 36, 24, 0.84), rgba(29, 20, 14, 0.84));
  border: 1px solid rgba(255, 158, 68, 0.12);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.nav a::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 12px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 181, 102, 0.35);
  transform: translateY(-50%);
  box-shadow: 0 0 12px rgba(255, 161, 63, 0.22);
}

.nav a.active,
.nav a:hover {
  transform: translateX(3px);
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px rgba(255, 162, 74, 0.12), 0 12px 28px rgba(0, 0, 0, 0.22);
}

.nav a.active::before,
.nav a:hover::before {
  background: var(--accent-soft);
}

.content {
  padding: 34px;
}

.hero,
.panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(44, 28, 19, 0.96), rgba(24, 17, 12, 0.96));
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  box-shadow: var(--shadow), var(--inner-shadow);
  padding: 32px;
}

.hero::before,
.panel::before,
.work-card::before,
.result-block::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 167, 80, 0.08);
  pointer-events: none;
}

.hero::after,
.panel::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle at top right, rgba(255, 142, 44, 0.22), transparent 68%);
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.9rem);
  line-height: 0.92;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hero-copy,
.panel-copy {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.card-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.work-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(52, 34, 22, 0.95), rgba(26, 18, 13, 0.95));
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  padding: 24px;
  box-shadow: var(--shadow);
}

.work-card::after {
  content: "";
  position: absolute;
  top: 18px;
  right: 18px;
  width: 74px;
  height: 74px;
  background:
    linear-gradient(135deg, rgba(255, 162, 74, 0.15), transparent 62%),
    radial-gradient(circle at center, rgba(255, 185, 110, 0.1), transparent 60%);
  clip-path: polygon(20% 0, 100% 0, 100% 80%, 80% 100%, 0 100%, 0 20%);
  pointer-events: none;
}

.work-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.work-card-body {
  margin: 18px 0 22px;
}

.work-card h2,
.result-block h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-category {
  margin: 0 0 10px;
  color: var(--accent-soft);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-metric {
  color: rgba(255, 214, 171, 0.72);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.work-card p {
  color: var(--muted);
  line-height: 1.78;
  min-height: 56px;
}

.work-card-muted {
  opacity: 0.78;
}

.work-card-muted .badge {
  color: #ffdfa9;
}

.badge {
  white-space: nowrap;
  padding: 6px 10px;
  border: 1px solid rgba(255, 186, 104, 0.32);
  background: linear-gradient(180deg, rgba(255, 139, 37, 0.18), rgba(255, 106, 0, 0.1));
  color: var(--success);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(255, 193, 129, 0.34);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #fff8f0;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(122, 48, 0, 0.34);
  transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.button::after {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid rgba(255, 236, 214, 0.18);
  clip-path: inherit;
  pointer-events: none;
}

.button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 14px 30px rgba(122, 48, 0, 0.42);
}

.button-muted {
  background: linear-gradient(180deg, rgba(110, 77, 50, 0.7), rgba(65, 46, 31, 0.7));
  color: rgba(255, 233, 207, 0.76);
  cursor: default;
  box-shadow: none;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.work-header {
  position: sticky;
  top: 20px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
  padding: 18px 20px;
  background: linear-gradient(180deg, rgba(32, 22, 16, 0.98), rgba(20, 15, 11, 0.98));
  border: 1px solid rgba(255, 162, 74, 0.18);
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
  box-shadow: var(--shadow);
}

.work-header-main .eyebrow {
  margin-bottom: 8px;
}

.work-title {
  font-size: clamp(1.4rem, 2vw, 2rem);
  letter-spacing: 0.06em;
}

.work-intro {
  margin: 10px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.work-status {
  padding: 14px 16px;
  background: rgba(47, 31, 21, 0.92);
  border: 1px solid rgba(255, 173, 88, 0.16);
}

.work-status-label {
  margin: 0 0 8px;
  color: var(--accent-soft);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.work-status strong {
  display: block;
  font-size: 0.96rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.work-status p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.work-status[data-state="waiting"] {
  border-color: rgba(255, 173, 88, 0.32);
}

.work-status[data-state="success"] {
  border-color: rgba(255, 193, 111, 0.3);
  box-shadow: inset 0 0 0 1px rgba(255, 193, 111, 0.08);
}

.work-status[data-state="error"] {
  border-color: rgba(255, 122, 89, 0.38);
}

.flow-section {
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(38, 25, 17, 0.94), rgba(22, 16, 12, 0.94));
  border: 1px solid rgba(255, 162, 74, 0.16);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.section-label {
  display: flex;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.section-label h2 {
  margin: 0;
  font-size: 1.12rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-label p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.section-index {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 180, 100, 0.3);
  background: linear-gradient(180deg, rgba(255, 138, 42, 0.16), rgba(255, 106, 0, 0.08));
  color: var(--accent-soft);
  font-weight: 800;
  letter-spacing: 0.08em;
  flex: 0 0 auto;
}

.upload-form {
  margin-top: 24px;
  display: grid;
  gap: 12px;
}

.upload-form label {
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.upload-dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  padding: 24px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(31, 23, 17, 0.98), rgba(20, 15, 11, 0.98));
  border: 1px dashed rgba(255, 163, 76, 0.34);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.upload-dropzone strong {
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.upload-plus {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 177, 96, 0.32);
  background: linear-gradient(180deg, rgba(255, 138, 42, 0.14), rgba(255, 106, 0, 0.08));
  color: var(--accent-soft);
  font-size: 2rem;
  line-height: 1;
}

.upload-dropzone[data-dragging="true"],
.upload-dropzone:hover,
.upload-dropzone:focus-visible {
  border-color: rgba(255, 190, 121, 0.7);
  box-shadow: 0 0 0 1px rgba(255, 162, 74, 0.14), inset 0 0 30px rgba(255, 132, 29, 0.06);
  transform: translateY(-1px);
  outline: none;
}

.upload-dropzone[data-has-file="true"] {
  border-style: solid;
}

.upload-file-name {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255, 138, 42, 0.1);
  border: 1px solid rgba(255, 173, 88, 0.16);
  color: var(--accent-soft);
  font-size: 0.84rem;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: 0;
}

.upload-form input[type="file"] {
  padding: 14px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(31, 23, 17, 0.98), rgba(20, 15, 11, 0.98));
  border: 1px dashed rgba(255, 163, 76, 0.28);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.upload-form input[type="text"],
.upload-form input[type="number"] {
  min-height: 48px;
  padding: 0 14px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(31, 23, 17, 0.98), rgba(20, 15, 11, 0.98));
  border: 1px solid rgba(255, 163, 76, 0.28);
  outline: none;
}

.editor-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.knowledge-group-list {
  display: grid;
  gap: 18px;
}

.knowledge-group-card {
  padding: 18px;
  background: linear-gradient(180deg, rgba(54, 36, 24, 0.94), rgba(25, 18, 13, 0.94));
  border: 1px solid rgba(255, 173, 88, 0.18);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}

.knowledge-group-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.knowledge-group-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(31, 23, 17, 0.98), rgba(20, 15, 11, 0.98));
  border: 1px solid rgba(255, 163, 76, 0.28);
  outline: none;
}

.knowledge-list,
.question-card-grid {
  display: grid;
  gap: 16px;
}

.knowledge-card,
.question-result-card {
  position: relative;
  padding: 18px;
  background: linear-gradient(180deg, rgba(46, 30, 20, 0.95), rgba(24, 17, 12, 0.95));
  border: 1px solid rgba(255, 162, 74, 0.16);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}

.knowledge-card-header,
.question-result-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
}

.knowledge-card-title {
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.knowledge-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.knowledge-card input[type="text"],
.knowledge-card input[type="number"] {
  width: 100%;
  min-height: 46px;
  margin-bottom: 14px;
  padding: 0 14px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(31, 23, 17, 0.98), rgba(20, 15, 11, 0.98));
  border: 1px solid rgba(255, 163, 76, 0.28);
  outline: none;
}

.knowledge-count-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
}

.ghost-button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 173, 88, 0.22);
  background: rgba(46, 31, 21, 0.92);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.ghost-button {
  min-height: 36px;
  color: rgba(255, 225, 189, 0.82);
}

.raw-panel {
  margin-top: 24px;
  padding: 18px;
  background: rgba(17, 12, 9, 0.72);
  border: 1px solid rgba(255, 162, 74, 0.14);
}

.raw-panel summary {
  cursor: pointer;
  color: var(--accent-soft);
  font-weight: 700;
}

.question-result-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.upload-form input[type="text"]::placeholder,
.upload-form input[type="number"]::placeholder {
  color: rgba(200, 178, 159, 0.68);
}

.result-block {
  position: relative;
  overflow: hidden;
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(42, 28, 19, 0.92), rgba(22, 17, 13, 0.92));
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.is-hidden {
  display: none !important;
}

.button:disabled {
  cursor: wait;
  filter: saturate(0.7);
  opacity: 0.8;
}

.error-block {
  border-color: rgba(255, 122, 89, 0.32);
}

pre {
  margin: 12px 0 0;
  padding: 18px;
  background: #0c0907;
  color: #ffd7a6;
  border: 1px solid rgba(255, 164, 76, 0.18);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding: 20px;
  }

  .hero,
  .panel {
    padding: 24px;
  }

  .work-header {
    position: static;
    grid-template-columns: 1fr;
  }

  .knowledge-count-grid {
    grid-template-columns: 1fr;
  }
}
