:root {
  --bg-base: #060b14;
  --bg-layer: #0d1728;
  --surface: rgba(10, 23, 40, 0.84);
  --surface-strong: rgba(8, 18, 32, 0.94);
  --line: rgba(152, 198, 230, 0.26);
  --line-strong: rgba(167, 214, 245, 0.44);
  --text: #e9f4ff;
  --muted: #9ebdd8;
  --brand: #4eb8ff;
  --brand-soft: #98dcff;
  --accent: #ffb46a;
  --ok: #6ad5a2;
  --shadow-sm: 0 12px 28px rgba(2, 10, 18, 0.28);
  --shadow-lg: 0 24px 64px rgba(2, 10, 18, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

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

::-webkit-scrollbar-track {
  background: rgba(6, 11, 20, 0.4);
}

::-webkit-scrollbar-thumb {
  background: rgba(78, 184, 255, 0.26);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(78, 184, 255, 0.44);
}

::selection {
  background: rgba(78, 184, 255, 0.28);
  color: #e9f6ff;
}

body {
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 9% 12%, rgba(78, 184, 255, 0.2) 0%, transparent 34%),
    radial-gradient(circle at 91% 9%, rgba(255, 180, 106, 0.16) 0%, transparent 36%),
    radial-gradient(circle at 86% 86%, rgba(106, 213, 162, 0.12) 0%, transparent 38%),
    linear-gradient(158deg, #101d30 0%, #091424 46%, #060b14 100%);
  padding: 20px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(66px);
  pointer-events: none;
  z-index: -1;
}

.orb-a {
  width: 300px;
  height: 300px;
  top: -100px;
  right: -70px;
  background: rgba(78, 184, 255, 0.2);
}

.orb-b {
  width: 280px;
  height: 280px;
  left: -70px;
  bottom: 9%;
  background: rgba(255, 180, 106, 0.18);
}

.hero,
.workspace,
.footer {
  max-width: 1480px;
  margin-left: auto;
  margin-right: auto;
}

.hero {
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background:
    linear-gradient(150deg, rgba(13, 33, 56, 0.9) 0%, rgba(9, 22, 38, 0.95) 100%),
    radial-gradient(circle at 88% -35%, rgba(152, 220, 255, 0.2) 0%, transparent 54%);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 2px;
  background: linear-gradient(90deg, rgba(152, 220, 255, 0.12) 0%, rgba(152, 220, 255, 0.82) 44%, rgba(255, 180, 106, 0.56) 100%);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid rgba(152, 220, 255, 0.36);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.84rem;
  background: rgba(8, 19, 32, 0.54);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.back-link:hover {
  border-color: rgba(152, 220, 255, 0.6);
  background: rgba(15, 38, 62, 0.78);
  color: var(--brand-soft);
}

.back-link svg {
  width: 14px;
  height: 14px;
}

.hero h1 {
  margin: 14px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Sora", "Noto Sans SC", sans-serif;
  font-size: clamp(1.9rem, 3.8vw, 2.75rem);
}

.title-icon {
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(152, 220, 255, 0.45);
  background: rgba(8, 21, 35, 0.72);
  color: var(--brand-soft);
}

.hero p {
  margin: 0;
  max-width: 980px;
  color: var(--muted);
  line-height: 1.68;
}

.hero a {
  color: var(--brand-soft);
}

.hero-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.workspace {
  margin-top: 14px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.74fr) minmax(0, 1.14fr);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-strong) 100%);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 690px;
}

.panel h2 {
  margin: 0;
  font-family: "Sora", "Noto Sans SC", sans-serif;
  font-size: 1.02rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h2 svg {
  width: 16px;
  height: 16px;
  color: var(--brand-soft);
}

.panel h3 {
  margin: 0;
  font-family: "Sora", "Noto Sans SC", sans-serif;
  font-size: 0.94rem;
  color: var(--brand-soft);
  display: flex;
  align-items: center;
  gap: 7px;
}

.panel h3 svg {
  width: 14px;
  height: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

textarea,
select,
input[type="color"],
input[type="range"] {
  width: 100%;
  font: inherit;
}

#markdownInput {
  min-height: 566px;
  resize: vertical;
  border-radius: 13px;
  border: 1px solid rgba(156, 201, 231, 0.34);
  background: rgba(5, 15, 26, 0.78);
  color: #e8f4ff;
  padding: 12px;
  line-height: 1.7;
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.89rem;
}

#markdownInput:focus {
  outline: none;
  border-color: rgba(78, 184, 255, 0.74);
  box-shadow: 0 0 0 3px rgba(78, 184, 255, 0.16);
}

.editor-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.control-grid {
  display: grid;
  gap: 10px;
}

select,
input[type="color"] {
  border: 1px solid rgba(157, 203, 233, 0.32);
  border-radius: 11px;
  padding: 9px 10px;
  background: rgba(6, 16, 28, 0.84);
  color: #e9f4ff;
}

select:focus,
input[type="color"]:focus {
  outline: none;
  border-color: rgba(78, 184, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(78, 184, 255, 0.16);
}

input[type="color"] {
  height: 40px;
  padding: 3px;
}

input[type="range"] {
  accent-color: var(--brand);
}

.toggles {
  border: 1px solid rgba(156, 201, 231, 0.24);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: rgba(5, 14, 24, 0.62);
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}

.toggle-item input {
  width: 15px;
  height: 15px;
  accent-color: var(--ok);
}

.actions {
  display: grid;
  gap: 8px;
}

.remix-box {
  border: 1px solid rgba(156, 201, 231, 0.26);
  border-radius: 13px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: rgba(4, 12, 21, 0.68);
}

#remixPromptOutput {
  min-height: 150px;
  resize: vertical;
  border: 1px solid rgba(156, 201, 231, 0.3);
  border-radius: 11px;
  background: rgba(6, 16, 28, 0.82);
  color: #deeffe;
  padding: 10px;
  line-height: 1.6;
  font-size: 0.84rem;
}

.preview-shell {
  border: 1px solid rgba(156, 201, 231, 0.26);
  border-radius: 16px;
  background: rgba(4, 12, 21, 0.66);
  padding: 12px;
  min-height: 586px;
  overflow: auto;
}

.platform-hint {
  margin: -2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.md-render {
  --md-accent: #1e7bce;
  --md-font-size: 16px;
  --md-line-height: 1.75;
  --md-width: 760px;
  max-width: min(var(--md-width), 100%);
  margin: 0 auto;
  padding: 18px;
  border-radius: 14px;
  background: #fdfefe;
  color: #1f2d3d;
  font-size: var(--md-font-size);
  line-height: var(--md-line-height);
  word-break: break-word;
  box-shadow: 0 10px 24px rgba(15, 42, 66, 0.14);
}

.md-render h1,
.md-render h2,
.md-render h3,
.md-render h4,
.md-render h5,
.md-render h6 {
  font-family: "Sora", "Noto Sans SC", sans-serif;
  line-height: 1.36;
  color: #0f2235;
}

.md-render h1 {
  border-bottom: 2px solid color-mix(in srgb, var(--md-accent) 38%, #d6e6f3 62%);
  padding-bottom: 0.35em;
}

.md-render h2 {
  border-left: 4px solid var(--md-accent);
  padding-left: 0.58em;
  margin-top: 1.8em;
}

.md-render p {
  margin: 0.95em 0;
}

.md-render blockquote {
  margin: 1em 0;
  border-left: 4px solid color-mix(in srgb, var(--md-accent) 62%, #bcd9ef 38%);
  background: #f6fbff;
  padding: 0.6em 0.85em;
  border-radius: 0 8px 8px 0;
  color: #33506a;
}

.md-render a {
  color: #1e74c8;
}

.md-render img {
  display: block;
  max-width: 100%;
  margin: 1.1em auto;
  border-radius: 8px;
}

.md-render.img-card-mode img {
  border: 1px solid #d2e6f6;
  box-shadow: 0 10px 26px rgba(22, 56, 83, 0.18);
}

.md-render code {
  font-family: "JetBrains Mono", Menlo, Consolas, monospace;
  background: #eff5fb;
  padding: 0.16em 0.34em;
  border-radius: 5px;
  font-size: 0.92em;
}

.md-render pre {
  overflow: auto;
  background: #0f172a;
  color: #e8ecf1;
  border-radius: 10px;
  padding: 0.9em;
}

.md-render pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.md-render table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: 0.95em;
}

.md-render th,
.md-render td {
  border: 1px solid #d3e2ef;
  padding: 0.5em 0.65em;
  text-align: left;
}

.md-render thead {
  background: #f1f7fc;
}

.md-render .md-link-refs {
  margin-top: 2em;
  border-top: 1px dashed #cbd9e4;
  padding-top: 1em;
  color: #516274;
  font-size: 0.9em;
}

.md-render .md-link-refs h3 {
  margin: 0 0 0.6em;
  font-family: "Sora", "Noto Sans SC", sans-serif;
  font-size: 1em;
  color: #1e3952;
}

.md-render.theme-wechat {
  --md-accent: #1464cb;
  background: #fdfefe;
}

.md-render.theme-blog {
  --md-accent: #1b6fbe;
  background: #fbfdff;
}

.md-render.theme-knowledge {
  --md-accent: #0c9b7c;
  background: #fbfffd;
}

.md-render.theme-sunrise {
  --md-accent: #e76f51;
  background: #fffdfa;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 13px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(2, 11, 20, 0.34);
}

.btn svg {
  width: 14px;
  height: 14px;
}

.btn-primary {
  color: #06253f;
  border-color: rgba(152, 220, 255, 0.68);
  background: linear-gradient(130deg, #9be4ff 0%, #59c4ff 45%, #3caee9 100%);
}

.btn-secondary {
  color: #ebf5ff;
  border-color: rgba(156, 201, 231, 0.34);
  background: rgba(10, 29, 47, 0.9);
}

.btn-ghost {
  color: var(--muted);
  border-style: dashed;
  border-color: rgba(156, 201, 231, 0.42);
  background: transparent;
}

.footer {
  margin-top: 28px;
  padding: 18px 16px 32px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  justify-content: center;
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.84rem;
  transition: color 0.18s;
}

.footer-nav a:hover {
  color: var(--brand-soft);
}

.footer-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  margin: 0;
  font-size: 0.79rem;
  color: var(--muted);
  opacity: 0.72;
}

.footer-dot {
  opacity: 0.45;
}

.footer svg,
.footer-icon {
  width: 14px;
  height: 14px;
  color: var(--brand-soft);
  flex: none;
}

.footer a {
  color: var(--brand-soft);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

@media (max-width: 1250px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  #markdownInput {
    min-height: 360px;
  }

  .preview-shell {
    min-height: 420px;
  }
}

@media (max-width: 820px) {
  body {
    padding: 12px;
  }

  .hero {
    border-radius: 18px;
    padding: 16px;
  }

  .hero h1 {
    font-size: 1.58rem;
  }

  .hero-actions {
    gap: 8px;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .editor-meta {
    flex-direction: column;
  }

  .panel {
    border-radius: 16px;
    padding: 12px;
  }

  .md-render {
    padding: 14px;
    font-size: 15px;
  }
}
