:root {
  --bg: #f3f0e8;
  --fg: #171b18;
  --muted: #62665f;
  --muted-2: #858980;
  --surface: #ebe7dd;
  --surface-2: #f8f6f0;
  --border: #d7d2c6;
  --border-strong: #aaa69b;
  --accent: #174b9b;
  --accent-strong: #103b7d;
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --shadow: 0 24px 70px rgba(31, 35, 30, .12);
}

body { min-height: 100vh; background: var(--bg); }
.btn { border-radius: 3px; box-shadow: none; }
.btn-primary { box-shadow: none; }

.tool-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg);
}
.tool-top {
  position: sticky;
  top: 0;
  z-index: 80;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(23, 27, 24, .18);
  background: rgba(243, 240, 232, .94);
  backdrop-filter: blur(12px);
  padding: 12px 28px;
}
.tool-mark {
  width: auto;
  height: 34px;
  border-radius: 2px;
  padding: 0 8px;
  font-family: "Songti SC", "Noto Serif SC", SimSun, serif;
  font-size: 12px;
  letter-spacing: .12em;
}
.tool-brand strong {
  font-family: "Songti SC", "Noto Serif SC", SimSun, serif;
  letter-spacing: .04em;
}
.tool-brand span { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.tool-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--fg);
  color: var(--fg);
  padding: 6px 0;
  font-size: 13px;
  font-weight: 700;
}
.tool-link:hover { color: var(--accent); border-color: var(--accent); }

.modal-overlay.standalone {
  position: static;
  display: block;
  min-height: calc(100vh - 70px);
  background: transparent;
  padding: 38px 28px 64px;
}
.modal-overlay.standalone .workbench-modal {
  width: min(1180px, 100%);
  max-height: none;
  margin: 0 auto;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.modal-overlay.standalone .modal-close { display: none; }
.modal-overlay.standalone .wb-inner { padding: 0; }
.modal-overlay.standalone .wb-head {
  min-height: auto;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  background: transparent;
  padding: 28px 0 34px;
}
.modal-overlay.standalone .wb-head h1,
.modal-overlay.standalone .wb-head h2 {
  max-width: none;
  margin-top: 10px;
  font-family: "Songti SC", "Noto Serif SC", Georgia, SimSun, serif;
  font-size: clamp(46px, 6vw, 72px);
  line-height: 1.08;
  letter-spacing: -.035em;
}
.modal-overlay.standalone .wb-head p {
  max-width: 66ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}
.wb-principles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}
.wb-principles span::before { content: "—"; margin-right: 7px; color: var(--accent); }
.tool-footer { max-width: 1180px; margin: 0 auto; padding: 22px 28px 34px; display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }
.tool-footer a { color: var(--accent); text-decoration: none; }

.modal-overlay.standalone .wb-layout {
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  padding-top: 18px;
}
.modal-overlay.standalone .wb-rail,
.modal-overlay.standalone .wb-compose {
  border-radius: 4px;
  box-shadow: none;
}
.modal-overlay.standalone .wb-rail { background: #e9e5da; }
.modal-overlay.standalone .wb-compose {
  min-height: 560px;
  background: var(--surface-2);
}
.modal-overlay.standalone .wb-keyword { min-height: 180px; }
.modal-overlay.standalone .wb-result { background: #fff; }
.wb-type-btn,
.wb-scenario,
.wb-tool-btn,
.wb-mode-toggle,
.wb-engine-toggle,
.wb-result,
.wb-input,
.wb-compose { border-radius: 4px; }

.wb-engine-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.wb-engine-toggle button {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--fg);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}
.wb-engine-toggle button:hover,
.wb-engine-toggle button.active {
  border-color: var(--fg);
  background: var(--fg);
  color: #fff;
}
.wb-engine-toggle button:focus-visible {
  outline: 3px solid rgba(23, 75, 155, .24);
  outline-offset: 2px;
}

#wbSettingsOverlay,
#wbDraftsOverlay { background: rgba(10, 12, 10, .58); }
#wbSettingsOverlay .modal,
#wbDraftsOverlay .modal { border-radius: 4px; box-shadow: var(--shadow); }

@media (max-width: 980px) {
  .modal-overlay.standalone .wb-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .tool-top { min-height: 62px; align-items: center; padding: 10px 18px; }
  .tool-brand span { display: none; }
  .tool-link { width: auto; white-space: nowrap; }
  .modal-overlay.standalone { padding: 18px 14px 42px; }
  .modal-overlay.standalone .wb-head { padding: 14px 4px 20px; }
  .modal-overlay.standalone .wb-head h1,
  .modal-overlay.standalone .wb-head h2 { font-size: 40px; line-height: 1.12; }
  .modal-overlay.standalone .wb-head p { margin-bottom: 0; font-size: 14px; }
.wb-principles { display: grid; gap: 4px; margin-top: 12px; }
.tool-footer { display: grid; }
  .modal-overlay.standalone .wb-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 12px;
  }
  .modal-overlay.standalone .wb-compose { order: 1; min-height: auto; }
  .modal-overlay.standalone .wb-rail { order: 2; }
  .modal-overlay.standalone .wb-keyword { min-height: 160px; }
  .wb-compose-top { gap: 14px; }
  .wb-scenarios { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; }
  .wb-scenario { white-space: nowrap; }
  .form-actions { align-items: stretch; }
  .form-actions .btn { width: 100%; }
}
