:root {
  color-scheme: light;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-strong: rgba(255, 255, 255, 0.88);
  --ink: #20211f;
  --muted: #696d68;
  --line: rgba(31, 34, 30, 0.14);
  --focus: #2f6cf6;
  --shadow: 0 18px 54px rgba(28, 29, 26, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: #eef6e3;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: 2;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: soft-light;
  opacity: 0.16;
  transform: translateZ(0);
  animation: glass-noise 2s steps(3) infinite both;
}

@keyframes glass-noise {
  0% {
    transform: translateZ(0);
  }

  10% {
    transform: translate3d(-5%, -5%, 0);
  }

  20% {
    transform: translate3d(-10%, 5%, 0);
  }

  30% {
    transform: translate3d(5%, -10%, 0);
  }

  40% {
    transform: translate3d(-5%, 15%, 0);
  }

  50% {
    transform: translate3d(-10%, 5%, 0);
  }

  60% {
    transform: translate3d(15%, 0, 0);
  }

  70% {
    transform: translate3d(10%, 0, 0);
  }

  80% {
    transform: translate3d(-15%, 0, 0);
  }

  90% {
    transform: translate3d(10%, 5%, 0);
  }

  100% {
    transform: translate3d(15%, 8%, 0);
  }
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.flow-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at 18% 72%, rgba(120, 211, 194, 0.42), transparent 34%),
    radial-gradient(circle at 74% 24%, rgba(243, 178, 200, 0.46), transparent 36%),
    #eef6e3;
}

.app-shell {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: 24px;
  min-height: 100svh;
  padding: 24px;
}

.app-shell.panel-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.panel-collapsed .controls {
  display: none;
}

.preview {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(24px, 6vw, 76px);
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: rgba(32, 33, 31, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  max-width: min(760px, 100%);
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(2.2rem, 4.7vw, 4.7rem);
  font-weight: 760;
  line-height: 1.02;
  letter-spacing: 0;
  text-shadow: 0 10px 36px rgba(60, 60, 56, 0.18);
}

h1 span {
  display: block;
}

.title-zh {
  white-space: nowrap;
}

.title-en {
  margin-top: 8px;
  font-size: 0.42em;
  font-weight: 680;
  opacity: 0.72;
}

.live-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 1px;
  width: min(640px, 100%);
  margin: 30px 0 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(20px);
}

.live-meta div {
  min-width: 0;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.2);
}

.live-meta dt {
  margin-bottom: 5px;
  color: rgba(32, 33, 31, 0.6);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.live-meta dd {
  margin: 0;
  color: rgba(32, 33, 31, 0.82);
  font-size: 0.92rem;
  font-weight: 650;
}

.controls {
  align-self: center;
  max-height: calc(100svh - 48px);
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(1.2);
}

.controls-title {
  min-width: 0;
}

.controls-header,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.controls-header {
  padding-bottom: 16px;
}

.controls h2 {
  margin: 4px 0 0;
  font-size: 1.52rem;
  letter-spacing: 0;
}

.controls h3 {
  margin: 0;
  font-size: 0.94rem;
  letter-spacing: 0;
}

.panel-collapse-button,
.panel-expand-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 26px rgba(28, 29, 26, 0.1);
  backdrop-filter: blur(20px) saturate(1.12);
}

.panel-collapse-button:hover,
.panel-expand-button:hover {
  background: var(--panel-strong);
}

.panel-collapse-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: rgba(32, 33, 31, 0.68);
}

.panel-expand-button {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.86rem;
  font-weight: 760;
}

.panel-expand-button[hidden] {
  display: none;
}

.panel-toggle-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ghost-button,
.copy-row button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
}

.ghost-button:hover,
.copy-row button:hover {
  background: var(--panel-strong);
}

.control-section {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.control-section:last-child {
  padding-bottom: 0;
}

.palette-section {
  padding-top: 14px;
}

.palette-section .section-head {
  gap: 10px;
}

.copy-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.preset-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.preset-select span {
  white-space: nowrap;
}

.preset-select select {
  width: 136px;
  min-height: 30px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
}

.preset-select select:hover {
  background: var(--panel-strong);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.color-row {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 5px;
  align-items: stretch;
}

.color-row span {
  position: absolute;
  top: 5px;
  left: 6px;
  z-index: 1;
  color: rgba(32, 33, 31, 0.58);
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.color-row input {
  width: 100%;
  height: 30px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
}

.color-row input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-row input::-webkit-color-swatch {
  border: 0;
  border-radius: 7px;
}

.color-row input::-moz-color-swatch {
  border: 0;
  border-radius: 7px;
}

.color-row code,
.config-output {
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.color-row code {
  min-width: 0;
  overflow: hidden;
  color: rgba(32, 33, 31, 0.74);
  font-size: 0.68rem;
  text-align: center;
  text-overflow: ellipsis;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: #2f6cf6;
}

.range-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.range-row span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
}

.range-row input {
  width: 100%;
  accent-color: #2f6cf6;
}

.range-row output {
  color: rgba(32, 33, 31, 0.68);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.export-section {
  padding-bottom: 0;
}

.config-output {
  min-height: 188px;
  max-height: 240px;
  margin: 13px 0 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: rgba(32, 33, 31, 0.84);
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.copy-status {
  min-height: 1.1rem;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

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

  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .preview {
    min-height: 58svh;
    padding: 36px 12px 12px;
  }

  h1 {
    font-size: clamp(2.4rem, 10vw, 4.4rem);
  }

  .controls {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .app-shell {
    gap: 12px;
  }

  .preview {
    align-items: stretch;
  }

  .live-meta {
    grid-template-columns: 1fr;
  }

  .controls-header,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .controls-header {
    flex-direction: row;
  }

  .panel-expand-button {
    top: 16px;
    right: 16px;
  }

  .palette-section .section-head {
    align-items: center;
    flex-direction: row;
  }

  .copy-row {
    justify-content: flex-start;
  }

  .preset-select {
    width: auto;
  }

  .preset-select select {
    width: 124px;
  }

  .palette-grid {
    gap: 6px;
  }

  .color-row code {
    font-size: 0.62rem;
  }

  .range-row {
    grid-template-columns: 92px minmax(0, 1fr) 46px;
  }
}
