:root {
  --wb-paper: #f3efe5;
  --wb-paper-strong: #fbf8f0;
  --wb-ink: #252a28;
  --wb-ink-soft: #59615d;
  --wb-line: rgba(67, 73, 69, .2);
  --wb-gold: #a67930;
  --wb-rust: #9b4031;
  --wb-jade: #54756f;
  --wb-blue: #57707b;
}

body.gelv-workbench {
  --primary: #8a3f31;
  --primary-light: #a75543;
  --primary-dark: #602b25;
  --gold: var(--wb-gold);
  --gold-light: #c79b53;
  --bg-primary: var(--wb-paper);
  --bg-secondary: rgba(226, 223, 211, .7);
  --bg-card: rgba(251, 248, 240, .91);
  --bg-dark: #28312f;
  --text-primary: var(--wb-ink);
  --text-secondary: #4d5651;
  --text-muted: #7a817c;
  --border: rgba(122, 99, 63, .38);
  --border-light: var(--wb-line);
  --shadow: 0 10px 30px rgba(54, 48, 39, .08);
  --shadow-lg: 0 22px 56px rgba(54, 48, 39, .12);
  --radius: 5px;
  --radius-lg: 7px;
  min-height: 100vh;
  background-color: #e7ebe8;
  background-image: linear-gradient(rgba(241, 245, 242, .84), rgba(241, 245, 242, .90)), url("platform/workbench-ambient-gpt.png");
  background-position: center top;
  background-size: cover;
  background-attachment: fixed;
  color: var(--wb-ink);
}

body.gelv-workbench::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: rgba(241, 245, 242, .64);
}

body.gelv-workbench .main-layout {
  min-height: 100vh;
  margin-top: 0;
  padding-top: 60px;
  background: transparent;
}

body.create-workbench .main-layout {
  grid-template-columns: 300px minmax(0, 1fr) 310px;
}

body.check-workbench .main-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

body.gelv-workbench .config-panel,
body.gelv-workbench .side-panel {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  max-height: calc(100vh - 60px);
  padding: 18px 16px 30px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(84, 117, 111, .38) transparent;
  background: rgba(237, 241, 237, .94);
  backdrop-filter: blur(18px) saturate(.75);
}

body.gelv-workbench .config-panel { border-right: 1px solid var(--wb-line); }
body.gelv-workbench .side-panel { border-left: 1px solid var(--wb-line); }

body.gelv-workbench .config-panel::before,
body.gelv-workbench .side-panel::before {
  display: block;
  margin: 0 0 16px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--wb-line);
  color: var(--wb-ink-soft);
  font-size: 10px;
  letter-spacing: .16em;
}

body.create-workbench .config-panel::before { content: "创作参数 / SETTINGS"; }
body.check-workbench .config-panel::before { content: "检测参数 / SETTINGS"; }
body.create-workbench .side-panel::before { content: "上下文 / CONTEXT"; }

body.gelv-workbench .panel-section,
body.gelv-workbench .side-section {
  margin: 0;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid rgba(67, 73, 69, .14);
}

body.gelv-workbench .panel-title,
body.gelv-workbench .side-title {
  margin-bottom: 9px;
  color: #515955;
  font: 600 12px/1.4 'Noto Sans SC', sans-serif;
  letter-spacing: 0;
}

body.gelv-workbench .panel-title i,
body.gelv-workbench .side-title i { color: var(--wb-rust); }

body.gelv-workbench .main-content {
  min-width: 0;
  max-height: calc(100vh - 60px);
  padding: 0 24px 60px;
  overflow-y: auto;
  background-image: linear-gradient(rgba(247, 249, 246, .84), rgba(247, 249, 246, .90)), url("platform/workbench-ambient-gpt.png");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  -webkit-backdrop-filter: blur(6px) saturate(92%);
  backdrop-filter: blur(6px) saturate(92%);
}

body.gelv-workbench .content-wrapper {
  width: min(100%, 1120px);
  max-width: 1120px;
  margin: 0 auto;
}

.workbench-modebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100%, 1120px);
  min-height: 66px;
  margin: 0 auto 18px;
  border-bottom: 1px solid rgba(67, 73, 69, .19);
  background: rgba(240, 244, 240, .9);
  backdrop-filter: blur(16px);
}

.workbench-mode-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.workbench-mode-title::before {
  content: "";
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid rgba(155, 64, 49, .28);
  background-image: url("platform/gelv-icon-atlas-gpt-v3.png");
  background-size: 400% 400%;
  background-position: 66.6667% 0;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.24);
}
body.check-workbench .workbench-mode-title::before { background-position: 33.3333% 0; }
body.create-workbench .workbench-mode-title::before { background-position: 66.6667% 0; }
.workbench-mode-title > i { color: var(--wb-rust); font-size: 16px; }
.workbench-mode-title div { display: grid; gap: 2px; }
.workbench-mode-title span { font: 700 16px/1.25 'Noto Serif SC', serif; }
.workbench-mode-title small { color: var(--text-muted); font-size: 8px; letter-spacing: .16em; }
.workbench-modebar nav { display: flex; align-items: center; gap: 4px; }
.workbench-modebar nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid transparent;
  color: var(--wb-ink-soft);
  font-size: 11px;
  text-decoration: none;
}
.workbench-modebar nav a:hover { border-color: var(--wb-line); background: rgba(255, 255, 255, .48); }
.workbench-modebar nav a.is-active { border-color: rgba(155, 64, 49, .34); color: var(--wb-rust); background: rgba(155, 64, 49, .07); }

body.gelv-workbench .input-card,
body.gelv-workbench .generation-panel,
body.gelv-workbench .performance-panel,
body.gelv-workbench .rag-context,
body.gelv-workbench .rag-validation-panel,
body.gelv-workbench .history-section {
  margin-bottom: 16px;
  border: 1px solid rgba(67, 73, 69, .2);
  border-radius: 6px;
  background: rgba(252, 253, 250, .9);
  box-shadow: 0 14px 34px rgba(63, 56, 46, .06);
}

body.gelv-workbench .input-card { padding: 18px; }
body.gelv-workbench .input-label { margin-bottom: 10px; color: #3d4541; }
body.gelv-workbench .input-label > span:first-child { font-weight: 700; }
body.gelv-workbench .input-label i { color: var(--wb-gold); }

body.gelv-workbench .text-input,
body.gelv-workbench .select-input,
body.gelv-workbench input,
body.gelv-workbench select,
body.gelv-workbench textarea {
  border-color: rgba(67, 73, 69, .24);
  border-radius: 4px;
  background: rgba(255, 255, 252, .77);
  color: var(--wb-ink);
  outline: 0;
}

body.gelv-workbench .text-input:focus,
body.gelv-workbench input:focus,
body.gelv-workbench select:focus,
body.gelv-workbench textarea:focus {
  border-color: rgba(84, 117, 111, .72);
  box-shadow: 0 0 0 3px rgba(84, 117, 111, .11);
}

body.gelv-workbench .text-input.large { min-height: 132px; line-height: 1.8; }

body.gelv-workbench .btn {
  min-height: 34px;
  border-radius: 4px;
  box-shadow: none;
  font-family: inherit;
}
body.gelv-workbench .btn-primary,
body.gelv-workbench .btn-gold { border-color: var(--wb-rust); background: var(--wb-rust); color: #fff9ee; }
body.gelv-workbench .btn-info { background: var(--wb-blue); color: white; }
body.gelv-workbench .btn-success { background: var(--wb-jade); color: white; }
body.gelv-workbench .btn-outline { border-color: rgba(67, 73, 69, .28); color: #4b5550; background: rgba(255, 255, 255, .34); }
body.gelv-workbench .btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.03); }

body.gelv-workbench .type-grid,
body.gelv-workbench .poet-grid,
body.gelv-workbench .rhyme-book-grid { gap: 5px; }
body.gelv-workbench .type-item,
body.gelv-workbench .poet-item,
body.gelv-workbench .rhyme-book-item,
body.gelv-workbench .yunbu-item,
body.gelv-workbench .sample-poem-btn,
body.gelv-workbench .version-item,
body.gelv-workbench .history-item {
  border-color: rgba(67, 73, 69, .18);
  border-radius: 4px;
  background: rgba(255, 255, 252, .55);
}
body.gelv-workbench .type-item.active,
body.gelv-workbench .poet-item.active,
body.gelv-workbench .rhyme-book-item.active,
body.gelv-workbench .yunbu-item.selected {
  border-color: rgba(155, 64, 49, .62);
  color: #6d3027;
  background: rgba(155, 64, 49, .08);
}

body.create-workbench .result-card {
  border: 1px solid rgba(67, 73, 69, .2);
  border-radius: 6px;
  background: rgba(249, 251, 248, .9);
  box-shadow: 0 22px 56px rgba(57, 51, 42, .09);
}
body.create-workbench .result-card.show {
  display: grid;
  grid-template-columns: minmax(310px, .84fr) minmax(410px, 1.16fr);
  align-items: start;
}

body.create-workbench .poem-display {
  position: relative;
  min-height: 580px;
  padding: 74px 34px 42px;
  overflow: hidden;
  border-right: 1px solid rgba(91, 75, 51, .22);
  background: linear-gradient(145deg, rgba(218, 205, 173, .78), rgba(238, 234, 216, .90)), url("platform/platform-ambient-gpt.png") 70% center / cover;
  color: var(--wb-ink);
  text-align: center;
  isolation: isolate;
}
body.create-workbench .poem-display::before {
  content: attr(data-poem-title);
  position: absolute;
  left: 18px;
  right: 18px;
  top: 108px;
  z-index: -1;
  overflow: hidden;
  color: rgba(113, 81, 45, .08);
  font: 700 70px/1 'Noto Serif SC', serif;
  letter-spacing: 0;
  white-space: nowrap;
}
body.create-workbench .poem-display::after {
  content: "";
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: -180px;
  z-index: -1;
  height: 340px;
  border: 1px solid rgba(84, 117, 111, .31);
  border-radius: 50%;
  box-shadow: 0 -13px 0 -12px rgba(155, 64, 49, .35), 0 -28px 0 -27px rgba(166, 121, 48, .42);
}
body.create-workbench .poem-display:focus-within,
body.check-workbench .poem-display:focus-within,
body.gelv-workbench .input-card:focus-within,
body.gelv-workbench .generation-panel:focus-within {
  box-shadow: inset 0 0 0 1px rgba(84,117,111,.42), 0 22px 56px rgba(57,51,42,.10);
}
.poem-era { display: block; color: rgba(72, 80, 76, .62); font-size: 9px; letter-spacing: .18em; }
body.create-workbench .poem-title { margin: 12px 0 27px; color: #774230; font: 700 43px/1.18 'Noto Serif SC', serif; letter-spacing: 0; }
body.create-workbench .poem-content { position: relative; color: #2d3431; font: 500 22px/2.15 'Noto Serif SC', serif; letter-spacing: .08em; }
body.create-workbench .poem-meta { position: relative; flex-wrap: wrap; gap: 8px 18px; margin-top: 28px; color: rgba(45, 52, 49, .58); font-size: 10px; }
.poem-expand {
  position: absolute;
  right: 18px;
  top: 18px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(67, 73, 69, .28);
  border-radius: 50%;
  color: #5a655f;
  background: rgba(255, 255, 255, .42);
  cursor: pointer;
}

.workbench-config-toggle {
  position: fixed;
  left: 14px;
  bottom: 18px;
  z-index: 220;
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(155, 64, 49, .45);
  border-radius: 50%;
  color: #fff8ed;
  background: var(--wb-rust);
  box-shadow: 0 12px 28px rgba(70, 48, 40, .24);
  cursor: pointer;
}
.workbench-config-toggle.is-open { color: var(--wb-rust); background: #fbf8ef; }

body.gelv-workbench .workbench-modebar { position: relative; }
body.gelv-workbench .workbench-modebar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 28%;
  height: 2px;
  background: linear-gradient(90deg, var(--wb-rust), rgba(155,64,49,0));
  pointer-events: none;
}

body.create-workbench .meter-section { min-width: 0; padding: 24px; }
body.create-workbench .result-actions { grid-column: 1 / -1; flex-wrap: wrap; justify-content: flex-end; padding: 13px 18px; background: rgba(238, 236, 226, .72); }
body.create-workbench #savedBadgeArea { grid-column: 1 / -1; }
body.create-workbench .meter-char { border: 1px solid rgba(67, 73, 69, .14); border-radius: 3px; }
body.create-workbench .meter-char:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(52, 58, 55, .11); }
body.create-workbench .meter-rules-display,
body.create-workbench .rhyme-info { border-radius: 4px; background: rgba(229, 227, 216, .62); }

body.check-workbench .result-card {
  border: 1px solid rgba(67, 73, 69, .2);
  border-radius: 6px;
  background: rgba(250, 252, 249, .92);
  box-shadow: 0 22px 56px rgba(57, 51, 42, .08);
}
body.check-workbench .result-card.show {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
}
body.check-workbench .result-header,
body.check-workbench .summary-stats,
body.check-workbench .linguistic-insight,
body.check-workbench .edit-notice { grid-column: 1 / -1; }
body.check-workbench .result-header { padding: 15px 18px; border-bottom: 1px solid var(--wb-line); background: rgba(225, 232, 227, .66); }
body.check-workbench .summary-stats { margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--wb-line); }
body.check-workbench .linguistic-insight { margin: 0; border: 0; border-bottom: 1px solid var(--wb-line); border-radius: 0; background: rgba(84, 117, 111, .06); }
body.check-workbench .poem-display { min-width: 0; margin: 0; padding: 22px 18px; overflow-x: auto; }
body.check-workbench .rhyme-analysis { margin: 0; border-left: 1px solid var(--wb-line); border-radius: 0; background: rgba(237, 232, 215, .5); }
body.check-workbench .issues-panel { grid-column: 2; margin: 0; padding: 0 16px 18px; border-left: 1px solid var(--wb-line); }
body.check-workbench .poem-line { min-width: 560px; }
body.check-workbench .char-cell { min-width: 52px; background: rgba(255, 255, 252, .5); }
body.check-workbench .char-cell:hover { background: rgba(84, 117, 111, .09); box-shadow: inset 0 0 0 1px rgba(84, 117, 111, .42); }
body.check-workbench .line-label { background: rgba(229, 227, 216, .72); }
body.check-workbench .char-popover { border: 1px solid rgba(67, 73, 69, .25); border-radius: 6px; background: #fbf8ef; box-shadow: 0 20px 55px rgba(46, 43, 37, .2); }

.poem-immersive {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  place-items: center;
  padding: 28px;
  background: rgba(39, 39, 34, .72);
  backdrop-filter: blur(12px);
}
.poem-immersive.is-open { display: grid; }
.poem-immersive-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, 1.15fr) minmax(280px, .85fr);
  width: min(1120px, 100%);
  height: min(720px, calc(100vh - 56px));
  overflow: hidden;
  border: 1px solid rgba(119, 82, 45, .35);
  background-color: #dcd1b6;
  background-image: linear-gradient(90deg, rgba(246, 242, 229, .90), rgba(226, 218, 196, .70)), url("platform/workbench-ambient-gpt.png");
  background-position: center;
  background-size: cover;
  box-shadow: 0 34px 100px rgba(25, 22, 17, .35);
}
.poem-immersive-stage::before {
  content: "";
  position: absolute;
  left: -8%;
  bottom: -52%;
  width: 76%;
  aspect-ratio: 1;
  border: 1px solid rgba(84, 117, 111, .4);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(166, 121, 48, .08), 0 0 0 36px rgba(155, 64, 49, .05);
}
.poem-immersive-title {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 8%;
  border-right: 1px solid rgba(67, 73, 69, .18);
}
.poem-immersive-title small { color: rgba(80, 69, 54, .55); font-size: 10px; letter-spacing: .2em; }
.poem-immersive-title h2 { margin: 16px 0 0; color: #74412f; font: 700 64px/1.08 'Noto Serif SC', serif; letter-spacing: 0; }
.poem-immersive-copy { position: relative; z-index: 2; display: grid; place-content: center; padding: 58px; }
.poem-immersive-lines { color: #29312e; font: 500 24px/2.25 'Noto Serif SC', serif; letter-spacing: .12em; text-align: center; }
.poem-immersive-meta { margin-top: 28px; color: rgba(48, 56, 52, .55); font-size: 10px; text-align: center; }
.poem-immersive-close {
  position: absolute;
  right: 20px;
  top: 20px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(67, 73, 69, .3);
  border-radius: 50%;
  color: #4e5752;
  background: rgba(255, 255, 255, .32);
  cursor: pointer;
}

@media (max-width: 1500px) {
  body.create-workbench .main-layout { grid-template-columns: 286px minmax(0, 1fr); }
  body.create-workbench .side-panel { display: none; }
}

@media (max-width: 1120px) {
  body.gelv-workbench .main-content { padding-inline: 18px; }
  body.create-workbench .result-card.show,
  body.check-workbench .result-card.show { grid-template-columns: 1fr; }
  body.create-workbench .poem-display { min-height: 500px; border-right: 0; border-bottom: 1px solid var(--wb-line); }
  body.check-workbench .poem-display,
  body.check-workbench .rhyme-analysis,
  body.check-workbench .issues-panel { grid-column: 1; border-left: 0; }
  body.check-workbench .rhyme-analysis { border-top: 1px solid var(--wb-line); }
}

@media (max-width: 768px) {
  body.gelv-workbench .main-layout { display: block; padding-top: 52px; }
  body.gelv-workbench .main-content { max-height: none; padding: 0 14px 44px; }
  body.gelv-workbench .config-panel {
    position: fixed;
    left: -310px;
    top: 52px;
    z-index: 200;
    width: 290px;
    min-width: 290px;
    max-width: 290px;
    height: calc(100vh - 52px);
    max-height: calc(100vh - 52px);
    transition: left .3s ease;
  }
  body.gelv-workbench .config-panel.show { left: 0; }
  .workbench-config-toggle { display: grid; }
  .workbench-modebar { min-height: 60px; margin-bottom: 14px; }
  .workbench-mode-title small { display: none; }
  .workbench-modebar nav a { width: 36px; justify-content: center; padding: 0; }
  .workbench-modebar nav a { font-size: 0; }
  .workbench-modebar nav a i { font-size: 12px; }
  body.gelv-workbench .input-card { padding: 14px; }
  body.gelv-workbench .input-label { align-items: flex-start; flex-direction: column; gap: 4px; }
  body.gelv-workbench .action-bar { align-items: stretch; flex-direction: column; gap: 10px; }
  body.gelv-workbench .action-left,
  body.gelv-workbench .action-right { flex-wrap: wrap; }
  body.gelv-workbench .action-right .btn { flex: 1; justify-content: center; }
  body.create-workbench .poem-display { min-height: 520px; padding: 66px 18px 34px; }
  body.create-workbench .poem-title { font-size: 36px; }
  body.create-workbench .poem-content { font-size: 20px; }
  body.create-workbench .poem-display::before { top: 112px; font-size: 44px; }
  body.create-workbench .meter-section { padding: 18px 14px; }
  body.create-workbench .meter-header { align-items: flex-start; flex-wrap: wrap; gap: 9px; }
  body.create-workbench .result-actions { justify-content: stretch; }
  body.create-workbench .result-actions .btn { flex: 1 1 128px; justify-content: center; }
  body.check-workbench .result-header { align-items: flex-start; flex-direction: column; gap: 12px; }
  body.check-workbench .result-header .result-actions { width: 100%; flex-wrap: wrap; }
  .poem-immersive { padding: 12px; }
  .poem-immersive-stage { display: block; height: calc(100vh - 24px); overflow-y: auto; }
  .poem-immersive-title { min-height: 42%; padding: 74px 28px 36px; border-right: 0; border-bottom: 1px solid var(--wb-line); }
  .poem-immersive-title h2 { font-size: 46px; }
  .poem-immersive-copy { min-height: 52%; padding: 40px 22px 58px; }
  .poem-immersive-lines { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  body.gelv-workbench *, body.gelv-workbench *::before, body.gelv-workbench *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
