:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #657180;
  --line: rgba(23, 32, 42, 0.12);
  --paper: #f6f1e8;
  --surface: #ffffff;
  --soft: #edf4f2;
  --mint: #95d8c9;
  --coral: #e95943;
  --blue: #1f5d90;
  --amber: #e9b44c;
  --plum: #6f557b;
  --shadow: 0 24px 70px rgba(28, 34, 43, 0.16);
  --fine-shadow: 0 12px 28px rgba(28, 34, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.8), rgba(255, 248, 236, 0.6) 38%, rgba(218, 233, 232, 0.72)),
    linear-gradient(150deg, rgba(31, 93, 144, 0.2) 0 18%, transparent 18% 32%, rgba(233, 180, 76, 0.2) 32% 47%, transparent 47% 64%, rgba(233, 89, 67, 0.16) 64% 80%, transparent 80%),
    var(--paper);
  background-attachment: fixed;
  letter-spacing: 0;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  background:
    repeating-linear-gradient(90deg, rgba(23, 32, 42, 0.035) 0 1px, transparent 1px 104px),
    repeating-linear-gradient(0deg, rgba(23, 32, 42, 0.03) 0 1px, transparent 1px 104px),
    linear-gradient(135deg, rgba(149, 216, 201, 0.44), transparent 34%),
    linear-gradient(315deg, rgba(111, 85, 123, 0.18), transparent 42%);
}

body::after {
  z-index: -1;
  opacity: 0.9;
  background:
    linear-gradient(118deg, transparent 0 8%, rgba(255, 255, 255, 0.42) 8% 18%, transparent 18% 100%),
    linear-gradient(132deg, transparent 0 58%, rgba(31, 93, 144, 0.12) 58% 68%, transparent 68% 100%),
    linear-gradient(20deg, transparent 0 66%, rgba(233, 89, 67, 0.12) 66% 78%, transparent 78% 100%);
  mask-image: linear-gradient(to bottom, #000, rgba(0, 0, 0, 0.78) 72%, rgba(0, 0, 0, 0.28));
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 38px;
}

.intro-band {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  min-height: 170px;
  padding: 28px 28px 30px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.56) 54%, rgba(255, 255, 255, 0.28)),
    linear-gradient(140deg, rgba(149, 216, 201, 0.58), rgba(233, 180, 76, 0.18) 45%, rgba(233, 89, 67, 0.2));
  box-shadow: 0 18px 58px rgba(28, 34, 43, 0.12);
  backdrop-filter: blur(20px);
}

.intro-band::before {
  content: "";
  position: absolute;
  inset: auto -4% -64px 42%;
  height: 140px;
  background:
    linear-gradient(90deg, #233248 0 16%, #1f5d90 16% 31%, #95d8c9 31% 46%, #e9b44c 46% 63%, #e95943 63% 78%, #6f557b 78% 100%);
  opacity: 0.24;
  transform: rotate(-7deg);
}

.intro-band > * {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: #285f78;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
  text-wrap: balance;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.15;
}

h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.intro-copy {
  max-width: 620px;
  margin-bottom: 0;
  color: #3f4952;
  font-size: 16px;
  line-height: 1.7;
}

.privacy-note {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 11px 15px;
  background: rgba(255, 255, 255, 0.64);
  color: #2e3a44;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(28, 34, 43, 0.1);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 20px;
  align-items: stretch;
  margin-top: 20px;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.68)),
    rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), transparent 34%),
    repeating-linear-gradient(90deg, rgba(23, 32, 42, 0.024) 0 1px, transparent 1px 36px);
  opacity: 0.74;
  pointer-events: none;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.upload-panel,
.palette-panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.ghost-button,
.primary-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 15px;
  font-size: 14px;
  font-weight: 800;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.ghost-button {
  border: 1px solid rgba(23, 32, 42, 0.13);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(28, 34, 43, 0.08);
}

.primary-button {
  background: linear-gradient(135deg, #17202a, #1f5d90);
  color: #fff;
  box-shadow: 0 12px 26px rgba(31, 93, 144, 0.26);
}

.ghost-button:hover,
.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 154px;
  border: 1.5px dashed rgba(31, 93, 144, 0.34);
  border-radius: 8px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(149, 216, 201, 0.3), rgba(255, 255, 255, 0.7) 46%, rgba(233, 180, 76, 0.16)),
    repeating-linear-gradient(135deg, rgba(23, 32, 42, 0.035) 0 1px, transparent 1px 18px),
    rgba(255, 255, 255, 0.74);
  color: #23303a;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--coral);
  background:
    linear-gradient(135deg, rgba(233, 89, 67, 0.16), rgba(255, 255, 255, 0.8)),
    #fff9f4;
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #17202a, #1f5d90);
  box-shadow: 0 12px 28px rgba(31, 93, 144, 0.28);
}

.upload-mark::before,
.upload-mark::after,
.upload-mark span {
  content: "";
  position: absolute;
  background: #fff;
}

.upload-mark::before {
  width: 22px;
  height: 3px;
  border-radius: 4px;
}

.upload-mark::after {
  width: 3px;
  height: 22px;
  border-radius: 4px;
}

.upload-mark span {
  width: 26px;
  height: 3px;
  bottom: 13px;
  border-radius: 4px;
  opacity: 0.5;
}

.drop-zone strong {
  font-size: 18px;
}

.drop-zone small {
  margin-top: 7px;
  color: var(--muted);
}

.preview-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: 16px;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(23, 32, 42, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(23, 32, 42, 0.045) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 32, 42, 0.045) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(23, 32, 42, 0.045) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(23, 32, 42, 0.045) 75%);
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
  box-shadow: var(--fine-shadow);
}

.preview-frame img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.78);
}

.preview-frame.has-image img {
  display: block;
}

.empty-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #72808b;
  font-size: 14px;
  font-weight: 800;
}

.preview-frame.has-image .empty-preview {
  display: none;
}

.control-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 8px;
  border: 1px solid rgba(23, 32, 42, 0.08);
  background: rgba(244, 247, 246, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.control-strip label {
  display: grid;
  gap: 8px;
  color: #34404b;
  font-size: 13px;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--coral);
}

.control-strip output {
  min-width: 48px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.palette-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.palette-summary > div {
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(237, 244, 242, 0.68)),
    #f8faf9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.palette-summary span {
  display: block;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.palette-summary small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.palette-stack {
  display: flex;
  overflow: hidden;
  min-height: 58px;
  border-radius: 8px;
  border: 1px solid rgba(23, 32, 42, 0.12);
  background: #eef2f3;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 12px 26px rgba(28, 34, 43, 0.1);
}

.stack-segment {
  min-width: 8px;
  transition: width 220ms ease;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.swatch-card {
  overflow: hidden;
  border: 1px solid rgba(23, 32, 42, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 26px rgba(28, 34, 43, 0.08);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.swatch-card:hover {
  box-shadow: 0 18px 34px rgba(28, 34, 43, 0.12);
  transform: translateY(-2px);
}

.swatch-color {
  min-height: 94px;
  border-bottom: 1px solid rgba(23, 32, 42, 0.08);
}

.swatch-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.hex-code {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.rgb-code {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ratio-badge {
  border-radius: 999px;
  padding: 7px 9px;
  background: rgba(237, 244, 242, 0.86);
  color: #27323b;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.copy-button {
  grid-column: 1 / -1;
  min-height: 34px;
  border-radius: 7px;
  background: linear-gradient(135deg, #17202a, #2f4052);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.small-button {
  min-height: 36px;
  padding-inline: 12px;
  font-size: 12px;
}

.export-panel {
  margin-top: 14px;
  border: 1px solid rgba(23, 32, 42, 0.1);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(246, 241, 232, 0.56)),
    #ffffff;
  box-shadow: var(--fine-shadow);
}

.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.record-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.export-button {
  display: grid;
  gap: 4px;
  min-height: 70px;
  border: 1px solid rgba(23, 32, 42, 0.1);
  border-radius: 8px;
  padding: 12px;
  background: rgba(248, 250, 249, 0.76);
  color: var(--ink);
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.export-button:hover {
  border-color: rgba(31, 93, 144, 0.34);
  background: #ffffff;
  transform: translateY(-1px);
}

.export-button:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.export-button strong {
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.export-button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 170px;
  margin-top: 14px;
  border: 1px dashed rgba(23, 32, 42, 0.18);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
  text-align: center;
  padding: 20px;
}

.palette-panel.has-colors .empty-state {
  display: none;
}

@media (max-width: 860px) {
  .intro-band,
  .workspace {
    grid-template-columns: 1fr;
  }

  .intro-band {
    display: grid;
    align-items: start;
    min-height: 0;
    padding: 24px;
  }

  .privacy-note {
    width: fit-content;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 22px, 520px);
    padding-top: 14px;
  }

  h1 {
    font-size: 34px;
  }

  .intro-band {
    padding: 20px;
  }

  .panel-head {
    align-items: start;
  }

  .ghost-button,
  .primary-button {
    padding-inline: 12px;
    font-size: 13px;
  }

  .upload-panel,
  .palette-panel {
    padding: 14px;
  }

  .drop-zone {
    min-height: 142px;
    padding: 20px 14px;
  }

  .swatch-grid {
    grid-template-columns: 1fr;
  }

  .export-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .palette-summary span {
    font-size: 23px;
  }
}
