:root {
  color-scheme: dark;
  --bg: #07090f;
  --bg-soft: #0d111a;
  --surface: rgba(255, 255, 255, 0.075);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.14);
  --ink: #f5f7fb;
  --muted: #a9b0bf;
  --faint: #737b8e;
  --accent: #7cf6d2;
  --accent-2: #7ab8ff;
  --amber: #f5c56c;
  --rose: #ff7a9f;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 12% 18%, rgba(124, 246, 210, 0.16), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(122, 184, 255, 0.17), transparent 30%),
    linear-gradient(145deg, #07090f 0%, #0b1018 52%, #12101a 100%);
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  line-height: 1.58;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 18px;
  font-size: 58px;
  line-height: 1.03;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 36px;
  line-height: 1.12;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 20px;
  line-height: 1.28;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(140px, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 15, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: #07100e;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 13px;
  font-weight: 950;
  box-shadow: 0 18px 44px rgba(124, 246, 210, 0.18);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.top-nav {
  display: inline-flex;
  gap: 6px;
  justify-content: center;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.nav-pill {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 900;
}

.nav-pill.active,
.nav-pill:hover {
  color: #07100e;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.header-action {
  justify-self: end;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(124, 246, 210, 0.34);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(124, 246, 210, 0.08);
  font-weight: 900;
}

.hero {
  position: relative;
  min-height: min(720px, calc(100vh - 76px));
  overflow: hidden;
  isolation: isolate;
}

.hero img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.08);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(7, 9, 15, 0.92), rgba(7, 9, 15, 0.66) 44%, rgba(7, 9, 15, 0.18)),
    linear-gradient(180deg, rgba(7, 9, 15, 0.1), rgba(7, 9, 15, 0.82));
}

.hero-content {
  display: grid;
  align-content: center;
  min-height: min(720px, calc(100vh - 76px));
  max-width: var(--max);
  margin: 0 auto;
  padding: 72px 26px;
}

.hero-content p:not(.eyebrow) {
  max-width: 680px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions,
.output-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.ghost-button,
.text-button {
  min-height: 44px;
  border-radius: var(--radius);
  font-weight: 950;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-button,
.ghost-button {
  padding: 0 18px;
}

.primary-button {
  border: 1px solid rgba(124, 246, 210, 0.78);
  color: #07100e;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 42px rgba(124, 246, 210, 0.18);
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.075);
}

.primary-button:hover,
.ghost-button:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.text-button {
  min-height: 34px;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
}

.signal-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: var(--max);
  margin: -44px auto 62px;
  position: relative;
  z-index: 2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(13, 17, 26, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.signal-strip div {
  display: grid;
  gap: 5px;
  min-height: 104px;
  padding: 22px;
  border-right: 1px solid var(--line);
}

.signal-strip div:last-child {
  border-right: 0;
}

.signal-strip span {
  color: var(--faint);
  font-size: 13px;
  font-weight: 850;
}

.signal-strip strong {
  font-size: 25px;
  line-height: 1.1;
}

.section-heading,
.tool-grid,
.workbench,
.history-section {
  max-width: var(--max);
  margin-right: auto;
  margin-left: auto;
  padding-right: 26px;
  padding-left: 26px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-top: 60px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 78px;
}

.tool-card {
  display: grid;
  gap: 14px;
  min-height: 244px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.052));
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.18);
}

.tool-card.active,
.tool-card:hover {
  border-color: rgba(124, 246, 210, 0.48);
  background: linear-gradient(180deg, rgba(124, 246, 210, 0.13), rgba(255, 255, 255, 0.058));
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  color: var(--accent);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 950;
}

.tool-card h3,
.tool-card p {
  margin-bottom: 0;
}

.tool-card p,
.workbench-head p,
.panel-title p,
.result-box p,
.result-box li,
.history-card p {
  color: var(--muted);
}

.workbench {
  margin-bottom: 34px;
}

.workbench-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.mode-badge span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(124, 246, 210, 0.11);
}

.workbench-layout {
  display: grid;
  grid-template-columns: 220px minmax(300px, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: stretch;
}

.tool-switcher,
.tool-panel,
.output-panel,
.history-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 17, 26, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.tool-switcher {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
}

.switch-button {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.switch-button strong,
.switch-button small {
  display: block;
}

.switch-button strong {
  color: var(--ink);
  font-size: 14px;
}

.switch-button small {
  color: var(--faint);
  font-size: 12px;
}

.switch-button.active,
.switch-button:hover {
  border-color: rgba(124, 246, 210, 0.38);
  background: rgba(124, 246, 210, 0.09);
}

.switch-code {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: #07100e;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 12px;
  font-weight: 950;
}

.tool-panel,
.output-panel {
  min-width: 0;
  padding: 20px;
}

.panel-title,
.output-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  justify-content: flex-start;
}

.panel-title > span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  color: #07100e;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 950;
}

.panel-title h3,
.panel-title p,
.output-head h3,
.output-head p {
  margin-bottom: 0;
}

.dynamic-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
}

textarea {
  min-height: 122px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: rgba(169, 176, 191, 0.58);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(124, 246, 210, 0.14);
  border-color: rgba(124, 246, 210, 0.72);
}

.form-actions {
  margin-top: 4px;
}

.result-box {
  min-height: 440px;
}

.empty-state {
  margin: 0;
  color: var(--faint);
}

.result-card {
  display: grid;
  gap: 18px;
}

.result-section h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.result-section ul,
.result-section ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.result-section li::marker {
  color: var(--accent);
}

.history-section {
  margin-bottom: 70px;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-height: 128px;
  padding: 14px;
}

.history-list > .empty-state {
  grid-column: 1 / -1;
  align-self: center;
}

.history-card {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.history-card strong {
  font-size: 14px;
}

.history-card span {
  color: var(--faint);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid rgba(124, 246, 210, 0.34);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(13, 17, 26, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

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

@media (max-width: 1120px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .top-nav {
    grid-column: 1 / -1;
    justify-self: stretch;
    overflow-x: auto;
  }

  .workbench-layout {
    grid-template-columns: 1fr;
  }

  .tool-switcher {
    display: flex;
    overflow-x: auto;
  }

  .switch-button {
    flex: 0 0 184px;
  }

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

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

@media (max-width: 720px) {
  .site-header {
    gap: 12px;
    padding: 12px 16px;
  }

  .brand strong {
    font-size: 16px;
  }

  .header-action {
    min-height: 38px;
    padding: 0 12px;
  }

  .top-nav {
    justify-content: flex-start;
  }

  h1 {
    font-size: 38px;
  }

  h2 {
    font-size: 28px;
  }

  .hero,
  .hero-content {
    min-height: 620px;
  }

  .hero-content {
    padding: 54px 20px;
  }

  .hero-content p:not(.eyebrow) {
    font-size: 16px;
  }

  .hero-overlay {
    background:
      linear-gradient(180deg, rgba(7, 9, 15, 0.86), rgba(7, 9, 15, 0.72) 48%, rgba(7, 9, 15, 0.94)),
      linear-gradient(90deg, rgba(7, 9, 15, 0.72), rgba(7, 9, 15, 0.2));
  }

  .hero-actions,
  .form-actions,
  .output-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .signal-strip {
    grid-template-columns: 1fr 1fr;
    margin: -28px 16px 44px;
  }

  .signal-strip div {
    min-height: 88px;
    padding: 16px;
  }

  .signal-strip strong {
    font-size: 19px;
  }

  .section-heading,
  .tool-grid,
  .workbench,
  .history-section {
    padding-right: 16px;
    padding-left: 16px;
  }

  .tool-grid,
  .history-list {
    grid-template-columns: 1fr;
  }

  .workbench-head,
  .panel-title,
  .output-head {
    display: grid;
  }

  .mode-badge {
    justify-self: start;
  }

  .result-box {
    min-height: 320px;
  }
}
