:root {
  --workbench-ink: #050811;
  --workbench-panel: #09111f;
  --workbench-panel-soft: #0d1729;
  --workbench-card: #101c31;
  --workbench-white: #edf7ff;
  --workbench-muted: #9bb2c9;
  --workbench-faint: #617894;
  --workbench-line: rgba(144, 188, 222, 0.14);
  --workbench-line-strong: rgba(90, 198, 255, 0.28);
  --workbench-green: #62ddff;
  --workbench-green-bright: #a9f4ff;
  --workbench-violet: #9d83ff;
  --workbench-sans: "Inter", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  --workbench-serif: "Instrument Serif", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--workbench-ink);
}

body {
  min-width: 320px;
  overflow: hidden;
  color: var(--workbench-white);
  font-family: var(--workbench-sans);
  -webkit-font-smoothing: antialiased;
}

a,
button {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button {
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--workbench-white);
  color: var(--workbench-ink);
  font-size: 0.8rem;
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.workbench-app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100vh;
  isolation: isolate;
  background:
    radial-gradient(circle at 82% 0%, rgba(67, 214, 255, 0.12), transparent 34%),
    radial-gradient(circle at 16% 100%, rgba(132, 100, 255, 0.1), transparent 30%),
    var(--workbench-ink);
}

.workbench-app::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(90, 198, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 198, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  content: "";
  opacity: 0.7;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 92%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 92%);
}

.workbench-app::after {
  position: absolute;
  top: -140px;
  left: 0;
  right: 0;
  z-index: -1;
  height: 140px;
  background: linear-gradient(180deg, transparent, rgba(90, 219, 255, 0.075), transparent);
  animation: workbench-scan 13s linear infinite;
  content: "";
  pointer-events: none;
}

@keyframes workbench-scan {
  from { transform: translateY(-140px); }
  to { transform: translateY(calc(100vh + 140px)); }
}

.workspace-heading,
.workspace-actions,
.panel-chrome,
.chrome-local {
  display: flex;
  align-items: center;
}

.workbench-layout {
  display: grid;
  grid-template-columns: minmax(220px, 236px) minmax(0, 1fr);
  min-height: 0;
  flex: 1 1 auto;
}

.tool-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 12px 14px 18px;
  border-right: 1px solid var(--workbench-line);
  background: rgba(5, 11, 22, 0.88);
  box-shadow: inset -1px 0 0 rgba(99, 116, 255, 0.1);
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 14px;
}

.sidebar-overline,
.workspace-overline {
  color: var(--workbench-green);
  font-size: 0.59rem;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.sidebar-home-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--workbench-green);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.sidebar-home-link svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.sidebar-home-link:hover,
.sidebar-home-link:focus-visible {
  border-color: rgba(90, 219, 255, 0.42);
  background: rgba(90, 219, 255, 0.1);
  color: var(--workbench-white);
}

.sidebar-count {
  color: var(--workbench-faint);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.57rem;
  white-space: nowrap;
}

.tool-nav {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--workbench-line-strong) transparent;
}

.tool-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tool-group + .tool-group {
  padding-top: 12px;
  border-top: 1px solid var(--workbench-line);
}

.tool-group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  padding: 0 10px 5px;
  color: var(--workbench-green);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.tool-group-heading small {
  color: var(--workbench-faint);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.57rem;
  letter-spacing: 0;
}

.tool-group-heading i {
  height: 1px;
  flex: 1 1 auto;
  background: var(--workbench-line);
}

.tool-tab {
  position: relative;
  display: grid;
  grid-template-columns: 22px 27px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 8px 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--workbench-muted);
  text-align: left;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.tool-tab-nested {
  padding-left: 14px;
}

.tool-tab:hover,
.tool-tab:focus-visible {
  border-color: var(--workbench-line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--workbench-white);
  transform: none;
  z-index: 10;
}

.tool-tab.is-active {
  border-color: rgba(90, 219, 255, 0.36);
  background: linear-gradient(105deg, rgba(90, 219, 255, 0.15), rgba(157, 131, 255, 0.1));
  box-shadow: inset 0 0 24px rgba(74, 155, 255, 0.07), 0 0 22px rgba(74, 155, 255, 0.08);
  color: var(--workbench-white);
}

.tool-tab.is-active::before {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: -1px;
  width: 2px;
  border-radius: 999px;
  background: var(--workbench-green-bright);
  box-shadow: 0 0 12px rgba(90, 219, 255, 0.82);
  content: "";
}

.tool-tab-index {
  align-self: start;
  padding-top: 3px;
  color: var(--workbench-faint);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.tool-tab.is-active .tool-tab-index {
  color: var(--workbench-green);
}

.tool-tab-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid var(--workbench-line);
  border-radius: 8px;
  color: var(--workbench-faint);
}

.tool-tab-icon svg {
  width: 15px;
  height: 15px;
}

.tool-tab.is-active .tool-tab-icon {
  border-color: rgba(90, 219, 255, 0.48);
  color: var(--workbench-green-bright);
}

.tool-tab-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.tool-tab-copy strong {
  overflow: hidden;
  color: inherit;
  font-size: 0.71rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-tab-copy small {
  overflow: hidden;
  color: var(--workbench-faint);
  font-size: 0.6rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-tab-arrow {
  color: var(--workbench-faint);
  font-size: 0.78rem;
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.tool-tab:hover .tool-tab-arrow,
.tool-tab:focus-visible .tool-tab-arrow,
.tool-tab.is-active .tool-tab-arrow {
  opacity: 1;
  transform: translate(0, 0);
}

.tool-tab-tooltip {
  position: fixed;
  top: var(--tooltip-top, 50vh);
  left: var(--tooltip-left, 300px);
  z-index: 40;
  width: 224px;
  padding: 10px 12px;
  border: 1px solid rgba(90, 219, 255, 0.32);
  border-radius: 10px;
  background: rgba(8, 16, 32, 0.98);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.48), 0 0 28px rgba(74, 155, 255, 0.1);
  color: var(--workbench-muted);
  font-size: 0.66rem;
  font-weight: 400;
  line-height: 1.55;
  opacity: 0;
  pointer-events: none;
  transform: translate(5px, -50%);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
  visibility: hidden;
}

.tool-tab:hover .tool-tab-tooltip,
.tool-tab:focus-visible .tool-tab-tooltip {
  opacity: 1;
  transform: translate(0, -50%);
  visibility: visible;
}

.workspace {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 10px 12px 12px;
}

.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  max-width: 1260px;
  width: 100%;
  margin: 0 auto 24px;
}

.workspace-heading {
  min-width: 0;
  align-items: flex-start;
  gap: 16px;
}

.workspace-index {
  padding-top: 5px;
  color: var(--workbench-green);
  font-family: var(--workbench-serif);
  font-size: 1.35rem;
  line-height: 1;
}

.workspace-overline {
  margin: 0 0 8px;
}

.workspace-heading h2 {
  overflow: hidden;
  margin: 0;
  color: var(--workbench-white);
  font-family: var(--workbench-serif);
  font-size: clamp(2.1rem, 4vw, 4.3rem);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.9;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-description {
  max-width: 510px;
  margin: 13px 0 0;
  color: var(--workbench-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.workspace-actions {
  flex: 0 0 auto;
  gap: 8px;
}

.subtle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 35px;
  padding: 0 12px;
  border: 1px solid var(--workbench-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--workbench-muted);
  font-size: 0.62rem;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.subtle-button:hover,
.subtle-button:focus-visible {
  border-color: rgba(90, 219, 255, 0.48);
  background: rgba(90, 219, 255, 0.1);
  color: var(--workbench-white);
}

.tool-panel {
  position: relative;
  display: flex;
  min-height: 0;
  max-width: 1260px;
  width: 100%;
  flex: 1 1 auto;
  flex-direction: column;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(90, 198, 255, 0.27);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(16, 31, 55, 0.42), transparent 42%), var(--workbench-panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42), 0 0 42px rgba(61, 138, 255, 0.08);
}

/* The operation surface is the page. Keep the shell intentionally quiet. */
.tool-panel {
  max-width: none;
  margin: 0;
  border-radius: 14px;
}

.tool-panel::before {
  position: absolute;
  top: 0;
  right: 12px;
  left: 12px;
  z-index: 2;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(90, 219, 255, 0.78), rgba(157, 131, 255, 0.62), transparent);
  content: "";
  pointer-events: none;
}

.panel-chrome {
  display: flex;
  flex: 0 0 34px;
  min-height: 34px;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--workbench-line);
  background: rgba(5, 11, 22, 0.78);
}

.chrome-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.chrome-dot-red { background: #df8e81; }
.chrome-dot-yellow { background: #dfc17c; }
.chrome-dot-green {
  background: var(--workbench-green-bright);
  box-shadow: 0 0 0 3px rgba(90, 219, 255, 0.1), 0 0 12px rgba(90, 219, 255, 0.55);
}

.chrome-label {
  min-width: 0;
  overflow: hidden;
  color: var(--workbench-white);
  font-family: var(--workbench-sans);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chrome-local {
  gap: 7px;
  margin-left: auto;
  color: var(--workbench-faint);
  font-size: 0.58rem;
  white-space: nowrap;
}

.chrome-local::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--workbench-green);
  box-shadow: 0 0 8px rgba(90, 219, 255, 0.55);
  content: "";
}

#tool-frame {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  border: 0;
  background: #08101c;
  visibility: hidden;
}

#tool-frame.is-ready {
  visibility: visible;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--workbench-green-bright);
  outline-offset: 3px;
}

@media (max-width: 1000px) {
  .tool-sidebar {
    padding-left: 18px;
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .workbench-app {
    height: auto;
    min-height: 100svh;
  }

  .workbench-layout {
    display: flex;
    flex-direction: column;
  }

  .tool-sidebar {
    display: block;
    padding: 25px 16px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--workbench-line);
  }

  .sidebar-heading {
    padding: 0 2px 14px;
  }

  .sidebar-home-link {
    min-height: 44px;
  }

  .tool-nav {
    display: flex;
    gap: 12px;
    overflow: visible;
    padding-bottom: 0;
  }

  .tool-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .tool-group + .tool-group {
    padding-top: 12px;
  }

  .tool-group-heading {
    grid-column: 1 / -1;
    padding-inline: 2px;
  }

  .tool-tab-tooltip {
    display: none;
  }

  .tool-tab {
    display: flex;
    min-width: 0;
    min-height: 68px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px;
  }

  .tool-tab-index {
    order: 0;
    padding: 0;
  }

  .tool-tab-icon {
    position: absolute;
    top: 10px;
    right: 10px;
  }

  .tool-tab-copy {
    margin-top: auto;
  }

  .tool-tab-copy strong,
  .tool-tab-copy small {
    max-width: 88px;
  }

  .tool-tab-arrow {
    display: none;
  }

  .tool-tab.is-active::before {
    top: auto;
    right: 13px;
    bottom: -1px;
    left: 13px;
    width: auto;
    height: 2px;
  }

  .workspace {
    min-height: 100svh;
    padding: 12px 12px 16px;
  }

  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 18px;
  }

  .workspace-actions {
    width: 100%;
  }

  .workspace-actions .subtle-button {
    flex: 1 1 auto;
  }

  .workspace-heading h2 {
    max-width: calc(100vw - 94px);
    font-size: 2.8rem;
  }

  .tool-panel {
    min-height: calc(100svh - 28px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .workbench-app::after {
    animation: none;
  }
}
