:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-elevated: #10141b;
  --panel: #0f131a;
  --panel-soft: #11161f;
  --field: #10141b;
  --field-hover: #121824;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(97, 151, 255, 0.52);
  --line-soft: rgba(255, 255, 255, 0.04);
  --text: #eef3fb;
  --muted: #98a2b3;
  --muted-soft: #707b8f;
  --blue: #6aa3ff;
  --blue-soft: rgba(106, 163, 255, 0.14);
  --green: #68d9a0;
  --danger: #ff7c93;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --font-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --font-mono: "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  scrollbar-color: rgba(106, 163, 255, 0.35) transparent;
}

body {
  color: var(--text);
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at top, rgba(106, 163, 255, 0.07), transparent 30%),
    linear-gradient(180deg, #090b10 0%, #0b0d12 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(106, 163, 255, 0.28);
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.noise-layer,
.glow {
  display: none;
}

.app-shell {
  width: min(1380px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: none;
  backdrop-filter: none;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  text-align: left;
}

.brand-zone {
  display: flex;
  justify-content: flex-start;
  width: 100%;
}

.brand-mark {
  display: none;
}

.brand-copy {
  max-width: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted-soft);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin: 0;
  color: var(--blue);
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.brand-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.topbar-side {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 10px;
}

.app-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-search {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.sidebar-head {
  color: var(--muted-soft);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.command-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.command-label {
  color: var(--muted-soft);
  font-size: 0.78rem;
}

.command-input-wrap {
  position: relative;
  width: 100%;
}

.command-input-wrap input,
.field,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--field);
  color: var(--text);
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.command-input-wrap input,
.field,
select {
  min-height: 44px;
  padding: 0 14px;
}

.command-input-wrap input {
  padding-right: 52px;
  font-size: 0.86rem;
}

.command-hint {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

textarea {
  min-height: 200px;
  padding: 14px 16px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.7;
}

.command-input-wrap input:focus,
.field:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--line-strong);
  background: var(--field-hover);
  box-shadow: 0 0 0 3px rgba(106, 163, 255, 0.08);
}

.meta-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.meta-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
}

.meta-pill-muted,
.meta-pill-success,
.meta-pill-danger {
  color: var(--muted);
}

.tool-tabs {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-group-toggle,
.tool-tab {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition:
    color 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.nav-group-toggle {
  min-height: 40px;
  padding: 0 12px;
  gap: 10px;
}

.nav-group-toggle:hover,
.tool-tab:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
}

.nav-group-toggle.active {
  color: #d8e7ff;
  border-color: rgba(106, 163, 255, 0.34);
  background: rgba(106, 163, 255, 0.05);
}

.nav-group-title {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.nav-group-chevron {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transform-origin: center;
  transition: transform 0.18s ease;
}

.nav-group.expanded .nav-group-chevron {
  transform: rotate(45deg);
}

.nav-group-tools {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-left: 12px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.nav-group-tools.expanded {
  display: flex;
}

.tool-tab {
  min-height: 34px;
  padding: 0 12px;
  border-color: transparent;
  font-size: 0.79rem;
}

.tool-tab.active {
  color: #d8e7ff;
  border-color: var(--line-strong);
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px rgba(106, 163, 255, 0.18);
}

.workspace-frame {
  min-width: 0;
  padding-top: 2px;
}

.workspace-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.workspace-copy {
  padding: 0;
}

.workspace-kicker {
  margin: 0 0 6px;
  color: var(--muted-soft);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.workspace-copy h2 {
  margin: 0 0 6px;
  font-size: clamp(1.02rem, 1.7vw, 1.26rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.tool-description {
  margin: 0;
  max-width: none;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.workspace-status,
.status-card {
  display: none;
}

.workspace-body {
  animation: panel-rise 0.2s ease;
}

.workspace-body > .panel {
  border: 0;
  background: transparent;
}

.card {
  padding: 0;
}

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

.card-header h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
}

.card-header p,
.card-note,
.muted {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.tool-layout {
  display: grid;
  gap: 22px;
}

.tool-layout.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-layout.single {
  grid-template-columns: minmax(0, 1fr);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-group label,
.toggle {
  color: var(--muted);
  font-size: 0.82rem;
}

.field-grid,
.button-row,
.option-row,
.hint-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.button-inline-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--field);
  color: var(--muted);
  white-space: nowrap;
}

.button-inline-select {
  width: auto;
  min-width: 104px;
  min-height: 32px;
  padding: 0 30px 0 10px;
  border-radius: 10px;
  background: var(--panel-soft);
}

.crypto-config-panel {
  gap: 12px;
}

.crypto-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.crypto-inline-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crypto-inline-row {
  display: grid;
  grid-template-columns: 68px 112px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.crypto-inline-row-no-action {
  grid-template-columns: 68px 112px minmax(0, 1fr);
}

.crypto-inline-label {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.crypto-inline-select {
  min-width: 0;
}

.crypto-inline-input {
  min-width: 0;
}

.crypto-inline-input-wide {
  grid-column: auto;
}

.crypto-inline-action {
  min-width: 96px;
  padding: 0 14px;
  white-space: nowrap;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toggle input {
  accent-color: var(--blue);
}

.btn,
.ghost-btn {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.btn:hover,
.ghost-btn:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}

.btn {
  border-color: rgba(106, 163, 255, 0.46);
  background: rgba(106, 163, 255, 0.06);
}

.btn.secondary,
.ghost-btn {
  color: var(--muted);
  background: transparent;
}

.btn.accent,
.btn.success {
  border-color: rgba(106, 163, 255, 0.46);
  background: rgba(106, 163, 255, 0.06);
}

.btn[disabled],
.ghost-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.hint-pill {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted-soft);
  font-size: 0.78rem;
  line-height: 1.6;
}

.stats-grid,
.hash-grid,
.result-grid {
  display: grid;
  gap: 12px;
}

.stats-grid,
.hash-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.result-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat-card,
.hash-card,
.preview-card,
.placeholder-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
}

.stat-card span,
.hash-card span,
.preview-card span {
  display: block;
  color: var(--muted-soft);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong,
.hash-card strong,
.preview-card strong,
.hash-card code {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  word-break: break-word;
}

.hash-card code {
  word-break: break-all;
}

.tone-success strong {
  color: var(--green);
}

.tone-danger strong {
  color: var(--danger);
}

.tool-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: left;
  font-size: 0.8rem;
  line-height: 1.6;
}

.tool-empty code {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.field-file {
  padding: 10px 14px;
}

.field-file::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
}

.preview-surface {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
}

.preview-surface-qr {
  min-height: 300px;
}

.preview-image,
.qr-canvas {
  display: none;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.preview-image.is-visible,
.qr-canvas.is-visible {
  display: block;
}

.preview-empty {
  display: none;
  padding: 18px;
  color: var(--muted-soft);
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.65;
}

.preview-empty.is-visible {
  display: block;
}

.diff-output {
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
}

.diff-output-head,
.diff-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.diff-output-head {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-bottom: 10px;
  padding-bottom: 10px;
  background: linear-gradient(180deg, rgba(17, 22, 31, 0.98), rgba(17, 22, 31, 0.78));
}

.diff-output-title {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.diff-output-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diff-row {
  position: relative;
  align-items: start;
}

.diff-row-group-start {
  margin-top: 10px;
}

.diff-row-marker {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.diff-cell {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f141d;
}

.diff-cell-same {
  background: rgba(255, 255, 255, 0.015);
}

.diff-cell-add {
  border-color: rgba(104, 217, 160, 0.24);
  background: rgba(104, 217, 160, 0.08);
}

.diff-cell-remove {
  border-color: rgba(255, 124, 147, 0.24);
  background: rgba(255, 124, 147, 0.08);
}

.diff-cell-ghost {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.02);
}

.diff-line-number {
  display: inline-flex;
  justify-content: center;
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  user-select: none;
}

.diff-line-code {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.81rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-inline {
  padding: 0 2px;
  border-radius: 4px;
  color: inherit;
}

.diff-inline-add {
  background: rgba(104, 217, 160, 0.2);
}

.diff-inline-remove {
  background: rgba(255, 124, 147, 0.2);
}

.diff-empty-side,
.diff-empty-line,
.diff-placeholder {
  color: var(--muted-soft);
}

.diff-placeholder {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  font-size: 0.84rem;
}

.diff-row-focus .diff-cell {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 2px rgba(106, 163, 255, 0.08);
}

.diff-row-focus {
  animation: diff-flash 0.9s ease;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 300px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(12, 15, 21, 0.96);
  color: var(--text);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

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

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes diff-flash {
  0% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-1px);
  }

  100% {
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw - 24px, 100%);
    padding-top: 22px;
  }

  .tool-layout.two-column,
  .field-grid,
  .crypto-meta-grid,
  .diff-output-head,
  .diff-row {
    grid-template-columns: 1fr;
  }

  .crypto-inline-row {
    grid-template-columns: 60px 104px minmax(0, 1fr);
  }

  .crypto-inline-action {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 18px;
  }

  .brand-copy h1 {
    font-size: 1.52rem;
  }

  textarea {
    min-height: 180px;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .button-row {
    flex-direction: column;
  }

  .btn,
  .ghost-btn {
    width: 100%;
  }

  .crypto-inline-row {
    grid-template-columns: 1fr;
  }

  .crypto-inline-label,
  .crypto-inline-select,
  .crypto-inline-input,
  .crypto-inline-action {
    width: 100%;
  }

  .tool-tab,
  .nav-group-toggle {
    width: 100%;
  }
}
