/* ============ Base ============ */
:root {
  --bg: #05070d;
  --bg-soft: #0a101c;
  --panel: rgba(17, 24, 39, 0.66);
  --panel-solid: #0e1524;
  --line: rgba(122, 162, 255, 0.14);
  --line-strong: rgba(122, 200, 255, 0.32);
  --text: #e8eeff;
  --muted: #8b97b8;
  --cyan: #22d3ee;
  --indigo: #6366f1;
  --violet: #a855f7;
  --grad: linear-gradient(115deg, #22d3ee 0%, #6366f1 52%, #a855f7 100%);
  --radius: 18px;
  --maxw: 1120px;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

::selection {
  background: rgba(99, 102, 241, 0.42);
}

/* ============ Ambient background ============ */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image: linear-gradient(rgba(110, 160, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 160, 255, 0.055) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 78%);
}

.orb {
  position: fixed;
  z-index: -2;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  pointer-events: none;
}

.orb-1 {
  width: 520px;
  height: 520px;
  top: -180px;
  left: -140px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.55), transparent 68%);
  animation: drift 18s ease-in-out infinite alternate;
}

.orb-2 {
  width: 560px;
  height: 560px;
  top: 120px;
  right: -200px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.5), transparent 70%);
  animation: drift 22s ease-in-out infinite alternate-reverse;
}

.orb-3 {
  width: 420px;
  height: 420px;
  bottom: -160px;
  left: 40%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.3), transparent 70%);
  animation: drift 26s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(40px, 50px, 0) scale(1.12); }
}

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(20px, 5vw, 56px);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: rgba(5, 7, 13, 0.62);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--grad);
  color: #04101a;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -1px;
  box-shadow: 0 0 22px rgba(99, 102, 241, 0.45);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
}

.brand-text em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.24em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
}

.nav a {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  transition: color 0.2s ease, background 0.2s ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--text);
  background: rgba(122, 162, 255, 0.09);
}

/* ============ Layout ============ */
.wrap {
  width: min(var(--maxw), 100% - 40px);
  margin: 0 auto;
}

/* ============ Hero ============ */
.hero {
  position: relative;
  padding: clamp(56px, 10vw, 104px) 0 clamp(36px, 6vw, 56px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.06);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: #9fe9f7;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.hero h1 {
  margin: 26px 0 20px;
  font-size: clamp(2.1rem, 5.6vw, 3.6rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p.lead {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.1rem);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 38px;
}

.stat {
  flex: 1 1 150px;
  max-width: 210px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(10px);
}

.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 600;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat span {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ============ Toolbar ============ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 30px;
}

.search-box {
  position: relative;
  flex: 1 1 260px;
  max-width: 380px;
}

.search-box svg {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 16, 28, 0.75);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input::placeholder {
  color: #5f6b88;
}

.search-box input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.chip[aria-pressed="true"] {
  color: #04101a;
  font-weight: 600;
  background: var(--grad);
  border-color: transparent;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.35);
}

/* ============ Post grid ============ */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 22px;
  padding-bottom: 20px;
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px 26px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(20, 28, 46, 0.86), rgba(10, 15, 26, 0.9));
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.post-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(560px circle at 15% 0%, rgba(34, 211, 238, 0.12), transparent 42%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.post-card:hover,
.post-card:focus-within {
  transform: translateY(-6px);
  border-color: var(--line-strong);
  box-shadow: 0 22px 48px -20px rgba(34, 211, 238, 0.32), 0 0 0 1px rgba(122, 200, 255, 0.12) inset;
}

.post-card:hover::after,
.post-card:focus-within::after {
  opacity: 1;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-link {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
}

.card-link:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-cat {
  padding: 4px 11px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.09);
  color: #8ce7f5;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.card-date {
  font-family: var(--mono);
  font-size: 12px;
  color: #66748f;
  letter-spacing: 0.05em;
}

.card-title {
  margin: 0 0 12px;
  font-size: 1.22rem;
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-excerpt {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.75;
  flex: 1;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(122, 162, 255, 0.1);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #7f8db0;
  letter-spacing: 0.02em;
}

.card-more {
  font-size: 13px;
  color: var(--cyan);
  opacity: 0.75;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.post-card:hover .card-more {
  opacity: 1;
  transform: translateX(3px);
}

.empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ============ About ============ */
.section {
  padding: clamp(48px, 8vw, 84px) 0;
}

.section-head {
  margin-bottom: 30px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: -0.01em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.about-card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
}

.about-card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 1.02rem;
  font-weight: 600;
}

.about-card h3 .dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--grad);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.7);
}

.about-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* ============ Footer ============ */
.site-footer {
  padding: 40px 0 56px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #5f6b88;
  font-size: 13px;
}

.footer-inner .mono {
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

/* ============ Progress bar ============ */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 2px;
  background: transparent;
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--grad);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.8);
  transition: width 0.1s linear;
}

/* ============ Article ============ */
.article {
  width: min(760px, 100% - 40px);
  margin: 0 auto;
  padding: clamp(44px, 8vw, 80px) 0 40px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 14px;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--cyan);
}

.article-head {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #66748f;
}

.article-meta .card-cat {
  font-family: inherit;
}

.article-head h1 {
  margin: 0 0 18px;
  font-size: clamp(1.7rem, 4.4vw, 2.5rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.prose {
  font-size: 16.5px;
  line-height: 1.95;
  color: #c9d4ec;
}

.prose p {
  margin: 0 0 22px;
}

.prose h2 {
  position: relative;
  margin: 44px 0 18px;
  padding-left: 16px;
  font-size: 1.32rem;
  line-height: 1.5;
  color: var(--text);
}

.prose h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.34em;
  width: 4px;
  height: 1.05em;
  border-radius: 2px;
  background: var(--grad);
}

.prose strong {
  color: #fff;
  font-weight: 600;
}

.prose ul,
.prose ol {
  margin: 0 0 22px;
  padding-left: 1.35em;
}

.prose li {
  margin-bottom: 10px;
}

.prose li::marker {
  color: var(--cyan);
}

.prose blockquote {
  margin: 0 0 22px;
  padding: 14px 20px;
  border-left: 3px solid var(--indigo);
  background: rgba(99, 102, 241, 0.07);
  border-radius: 0 10px 10px 0;
  color: var(--muted);
}

.prose pre {
  margin: 0 0 22px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #070b14;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: #8ce7f5;
}

.prose p code,
.prose li code {
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(34, 211, 238, 0.1);
}

.article-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 56px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.pager {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.pager:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
}

.pager-next {
  text-align: right;
}

.pager-label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #66748f;
  letter-spacing: 0.08em;
}

.pager-title {
  font-size: 14.5px;
  color: var(--text);
}

.not-found {
  padding: 60px 0;
  text-align: center;
}

.not-found h2 {
  margin: 0 0 12px;
  font-size: 1.6rem;
}

.not-found p {
  margin: 0 0 28px;
  color: var(--muted);
}

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 11px;
  background: var(--grad);
  color: #04101a;
  font-weight: 600;
  font-size: 14.5px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -10px rgba(99, 102, 241, 0.7);
}

/* ============ Responsive ============ */
@media (max-width: 640px) {
  .site-header {
    padding: 13px 18px;
  }
  .nav a:last-child {
    display: none;
  }
  .post-grid {
    grid-template-columns: 1fr;
  }
  .stat {
    max-width: none;
    flex-basis: calc(50% - 7px);
  }
  .toolbar {
    align-items: stretch;
  }
  .search-box {
    max-width: none;
  }
  .prose {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============ Tools page ============ */
[hidden] {
  display: none !important;
}

.tool-hero {
  padding: clamp(48px, 8vw, 88px) 0 34px;
}

.tool-hero h1 {
  margin: 22px 0 16px;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 22px;
  align-items: start;
  padding-bottom: 10px;
}

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(20, 28, 46, 0.86), rgba(10, 15, 26, 0.9));
  backdrop-filter: blur(10px);
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.panel-tag {
  padding: 4px 10px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.08);
  color: #8ce7f5;
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}

/* Dropzone */
.dropzone {
  padding: 38px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(9, 14, 24, 0.6);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.07);
}

.drop-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  stroke: var(--cyan);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop-title {
  margin: 0 0 6px;
  font-size: 15px;
}

.drop-sub {
  margin: 0;
  color: #66748f;
  font-size: 12.5px;
}

.link-btn {
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--cyan);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Crop */
.crop-stage {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #070b14;
  overflow: hidden;
}

.crop-stage canvas {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}

.crop-tools {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.crop-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crop-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
}

.chips-sm {
  gap: 7px;
}

.chips-sm .chip {
  padding: 6px 13px;
  font-size: 12.5px;
}

.crop-actions {
  display: flex;
  gap: 8px;
}

.ghost-btn {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

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

/* Controls */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.field output {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 12px;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(122, 162, 255, 0.16);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid #0a101c;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.6);
  cursor: pointer;
  -webkit-appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #0a101c;
  border-radius: 50%;
  background: #22d3ee;
  cursor: pointer;
}

select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b111d;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

select:focus {
  border-color: var(--line-strong);
}

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 4px 0 18px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.switch-track {
  position: relative;
  flex: none;
  width: 38px;
  height: 21px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(122, 162, 255, 0.16);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #8b97b8;
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch input:checked + .switch-track {
  border-color: rgba(34, 211, 238, 0.5);
  background: rgba(34, 211, 238, 0.25);
}

.switch input:checked + .switch-track::after {
  transform: translateX(17px);
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.8);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Result */
.result-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 210px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: repeating-conic-gradient(#0b111d 0% 25%, #090e18 0% 50%) 50% / 18px 18px;
}

.result-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 420px;
  border-radius: 6px;
}

.preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.svg-preview {
  display: flex;
  width: 100%;
  justify-content: center;
}

.svg-preview svg {
  display: block;
  max-width: 100%;
  max-height: 420px;
}

.result-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #5f6b88;
  font-size: 13.5px;
}

/* Export */
.export-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.field-inline {
  flex: 1 1 150px;
  margin-bottom: 0;
}

#export-btn {
  padding: 12px 22px;
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

#export-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hint {
  margin: 12px 0 0;
  color: #66748f;
  font-family: var(--mono);
  font-size: 12.5px;
}

.tool-tips {
  padding-top: 10px;
}

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

@media (max-width: 640px) {
  .panel {
    padding: 16px;
  }
  .result-stage canvas {
    max-height: 320px;
  }
}
