@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&family=Noto+Sans+JP:wght@500;700;800;900&display=swap");

:root {
  --paper: #f3f0e8;
  --paper-cool: #eaf1f0;
  --card: #fffdf8;
  --ink: #17201d;
  --muted: #69736e;
  --line: #d8d9d1;
  --pink: #e95787;
  --pink-soft: #fde8f0;
  --blue: #3e79ff;
  --blue-soft: #e8eeff;
  --coral: #f77359;
  --yellow: #f4c64f;
  --green: #10a77e;
  --violet: #6f48ff;
  --shadow: 0 24px 60px rgb(28 40 35 / 10%);
  color: var(--ink);
  font-family: "Noto Sans JP", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background:
    radial-gradient(circle at 4% 4%, rgb(0 185 198 / 12%), transparent 28rem),
    radial-gradient(circle at 96% 3%, rgb(233 87 135 / 14%), transparent 31rem),
    var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  background: transparent;
}

button,
input {
  font: inherit;
}

button,
input[type="range"],
input[type="color"] {
  cursor: pointer;
}

button {
  color: inherit;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

h1,
h2,
h3,
p,
pre {
  margin: 0;
}

.page {
  width: min(1540px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0 4px 24px;
}

.hero-title {
  flex-basis: 100%;
  min-width: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: #bd2f62;
  font-family: "Archivo Black", sans-serif;
  font-size: 11px;
  letter-spacing: .15em;
}

.eyebrow i {
  position: relative;
  width: 20px;
  height: 20px;
}

.eyebrow i::before,
.eyebrow i::after {
  position: absolute;
  top: 3px;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
  content: "";
}

.eyebrow i::before { left: 0; }
.eyebrow i::after { right: 0; border-color: var(--blue); }

h1 {
  font-family: "Archivo Black", "Noto Sans JP", sans-serif;
  font-size: clamp(48px, 5.35vw, 86px);
}

.lead {
  flex: 1 1 420px;
  min-width: 300px;
  color: var(--muted);
  font-size: clamp(15px, 1.55vw, 22px);
  font-weight: 900;
}

.lead code {
  color: var(--pink);
}

.hero-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.support-chip,
.button {
  border-radius: 13px;
  font-size: 11px;
  font-weight: 900;
}

.support-chip {
  padding: 14px 16px;
  border: 1px solid #efb6ca;
  color: #a52353;
  background: var(--pink-soft);
}

.support-chip.is-unsupported {
  border-color: #efb4a7;
  color: #a23f2c;
  background: #fde8e3;
}

.button {
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid var(--line);
  background: white;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgb(23 32 29 / 10%);
}

.button--quiet {
  background: rgb(255 255 255 / 76%);
}

.button--dark {
  border-color: var(--ink);
  color: white;
  background: var(--ink);
}

.button--coral {
  margin-left: auto;
  border-color: var(--coral);
  color: white;
  background: var(--coral);
}

.studio {
  display: grid;
  grid-template-columns: minmax(390px, 470px) minmax(680px, 1fr);
  align-items: start;
  gap: 18px;
}

.control-card,
.comparison-card,
.output-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgb(255 253 248 / 95%);
  box-shadow: var(--shadow);
}

.control-card {
  position: sticky;
  top: 16px;
}

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

.panel-head {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 76px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head--wide {
  padding-right: 22px;
}

.panel-head p,
.control-title span,
.same-condition,
.space-note > span,
.ratio-summary span {
  color: #a23860;
  font-family: "Archivo Black", sans-serif;
  font-size: 9px;
  letter-spacing: .1em;
}

.panel-head h2 {
  margin-top: 2px;
  font-size: 20px;
  line-height: 1.25;
}

.section-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  color: white;
  font-family: "Archivo Black", sans-serif;
  font-size: 11px;
}

.section-mark--pink { background: var(--pink); }
.section-mark--blue { background: var(--blue); }
.section-mark--coral { background: var(--coral); }

.same-condition {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 10px 12px;
  border-radius: 999px;
  color: #2859bf;
  background: var(--blue-soft);
}

.same-condition i {
  position: relative;
  width: 22px;
  height: 10px;
}

.same-condition i::before,
.same-condition i::after {
  position: absolute;
  top: 1px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  content: "";
}

.same-condition i::before { left: 1px; }
.same-condition i::after { right: 1px; }

.control-section {
  padding: 19px 20px 20px;
  border-bottom: 1px solid var(--line);
}

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

.control-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 13px;
}

.control-title h3 {
  margin-top: 3px;
  font-size: 15px;
}

.control-title output {
  color: #a23860;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
  text-align: right;
}

.ratio-number {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #efb6ca;
  border-radius: 10px;
  color: #a23860;
  background: var(--pink-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
}

.ratio-number input {
  width: 38px;
  padding: 0;
  border: 0;
  outline: 0;
  color: inherit;
  background: transparent;
  font-family: inherit;
  font-weight: inherit;
  text-align: right;
  appearance: textfield;
}

.ratio-number input::-webkit-inner-spin-button,
.ratio-number input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.ratio-number:focus-within {
  box-shadow: 0 0 0 3px rgb(233 87 135 / 16%);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.preset-grid button {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 76px;
  padding: 9px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  font-size: 8px;
  font-weight: 900;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.preset-grid button:hover {
  transform: translateY(-2px);
}

.preset-grid button[aria-pressed="true"] {
  border-color: var(--pink);
  background: var(--pink-soft);
}

.preset-grid i {
  position: relative;
  width: 43px;
  height: 32px;
}

.preset-grid b {
  position: absolute;
  top: 3px;
  width: 26px;
  height: 26px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--swatch);
}

.preset-grid b:first-child { left: 1px; }
.preset-grid b:last-child { right: 1px; }
.preset-grid span { display: block; }

.color-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 9px;
}

.color-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.color-field > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-family: "Archivo Black", sans-serif;
  font-size: 8px;
  letter-spacing: .08em;
}

.color-field input {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.color-field input::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input::-webkit-color-swatch { border: 2px solid var(--ink); border-radius: 10px; }
.color-field input::-moz-color-swatch { border: 2px solid var(--ink); border-radius: 10px; }

.color-field output {
  min-width: 0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
}

.pair-arrow {
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
}

.range-block {
  padding-top: 3px;
}

.ratio-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 7px 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-a, #325bff), var(--color-b, #f4ff6a));
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 1px 5px rgb(23 32 29 / 35%);
  appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 1px 5px rgb(23 32 29 / 35%);
}

.ratio-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 11px;
}

.ratio-presets button {
  min-width: 0;
  min-height: 30px;
  padding: 0 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: white;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 900;
}

.ratio-presets button[aria-pressed="true"] {
  border-color: var(--pink);
  color: #a23860;
  background: var(--pink-soft);
}

.segmented {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f0efe9;
}

.segmented::before {
  position: absolute;
  z-index: -1;
  top: 4px;
  bottom: 4px;
  left: calc(4px + (100% - 8px) / 2 * var(--active-index, 0));
  width: calc((100% - 8px) / 2);
  border-radius: 9px;
  background: white;
  box-shadow: 0 3px 10px rgb(23 32 29 / 8%);
  content: "";
  transition: left 220ms cubic-bezier(.22, 1, .36, 1), width 220ms cubic-bezier(.22, 1, .36, 1);
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  font-weight: 900;
}

.segmented button[aria-pressed="true"] {
  color: var(--ink);
}

@supports (left: anchor(left)) {
  .hue-switch button[aria-pressed="true"] {
    anchor-name: --hue-active;
  }

  .hue-switch::before {
    position-anchor: --hue-active;
    top: anchor(top);
    left: anchor(left);
    width: anchor-size(width);
    height: anchor-size(height);
  }
}

.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.6;
}

.hint code {
  color: var(--pink);
  font-weight: 900;
}

.comparison-board {
  display: grid;
  gap: 10px;
  padding: 18px;
  background:
    linear-gradient(rgb(23 32 29 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(23 32 29 / 4%) 1px, transparent 1px),
    #f8faf7;
  background-size: 32px 32px;
}

.mix-row {
  display: grid;
  grid-template-columns: 160px minmax(240px, 1fr) 178px;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgb(255 253 248 / 92%);
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.mix-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgb(23 32 29 / 8%);
}

.mix-row.is-selected {
  border-color: var(--violet);
  box-shadow: inset 0 0 0 1px var(--violet), 0 8px 22px rgb(111 72 255 / 10%);
}

.space-meta b {
  display: block;
  font-family: "Archivo Black", sans-serif;
  font-size: 17px;
}

.space-meta small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.45;
}

.gradient-track {
  position: relative;
  display: block;
  height: 54px;
  border: 3px solid var(--ink);
  border-radius: 15px;
  background: linear-gradient(90deg, var(--color-a, #325bff), var(--color-b, #f4ff6a));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 35%);
  cursor: ew-resize;
  touch-action: none;
}

.position-pin {
  position: absolute;
  top: 50%;
  left: var(--pin, 50%);
  width: 17px;
  height: 66px;
  border: 3px solid white;
  border-radius: 999px;
  background: transparent;
  box-shadow: 0 0 0 2px var(--ink), 0 5px 12px rgb(23 32 29 / 20%);
  transform: translate(-50%, -50%);
}

.position-pin::after {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 36px;
  padding: 4px 5px;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  content: attr(data-value);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  transform: translate(-50%, -50%);
}

.sample {
  display: grid;
  grid-template-columns: 47px 1fr;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sample > i {
  width: 47px;
  height: 47px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--mixed-color, #aaa);
  box-shadow: 5px 6px 0 rgb(23 32 29 / 10%);
}

.sample code {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ratio-summary {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  border-top: 1px solid var(--line);
}

.ratio-summary > div {
  display: grid;
  place-items: center;
  min-height: 76px;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.ratio-summary > div:last-child { border-right: 0; }

.ratio-summary strong {
  margin-top: 2px;
  font-family: "Archivo Black", sans-serif;
  font-size: 20px;
}

.summary-mix {
  grid-template-columns: 56px 1fr !important;
  grid-template-rows: auto auto;
  column-gap: 12px;
}

.summary-mix span,
.summary-mix strong {
  justify-self: start;
}

.summary-mix i {
  grid-row: 1 / 3;
  width: 56px;
  height: 44px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--mixed-color, #aaa);
}

.panel-head--dark {
  border-bottom-color: rgb(255 255 255 / 12%);
  color: white;
  background: #131b18;
}

.panel-head--dark p {
  color: #f5b74b;
}

.output-card {
  border-color: #131b18;
  background: #0d1412;
}

.output-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, .55fr);
  gap: 12px;
  padding: 14px;
}

.output-grid pre {
  overflow: auto;
  min-height: 196px;
  max-height: 260px;
  padding: 19px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 17px;
  color: #e9f1ed;
  background: #060a09;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.7;
  white-space: pre-wrap;
}

.space-note {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 17px;
  color: white;
  background: #1d1a2c;
}

.space-note > span {
  color: #bcaeff;
}

.space-note h3 {
  margin-top: 8px;
  font-family: "Archivo Black", sans-serif;
  font-size: 28px;
}

.space-note p {
  margin-top: 9px;
  color: #bbbfc0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.75;
}

.mini-spectrum {
  height: 54px;
  margin-top: 17px;
  border: 2px solid rgb(255 255 255 / 70%);
  border-radius: 14px;
  background: linear-gradient(90deg, var(--color-a, #325bff), var(--color-b, #f4ff6a));
}

@media (max-width: 1180px) {
  .studio {
    grid-template-columns: minmax(330px, 400px) minmax(570px, 1fr);
  }

  .mix-row {
    grid-template-columns: 130px minmax(200px, 1fr) 126px;
  }

  .sample {
    grid-template-columns: 40px 1fr;
  }

  .sample > i {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 960px) {
  .page {
    width: min(760px, calc(100% - 28px));
    padding-top: 22px;
  }

  .hero-actions {
    flex-wrap: wrap;
  }

  .studio {
    grid-template-columns: 1fr;
  }

  .control-card {
    position: static;
  }
}

@media (max-width: 680px) {
  .page {
    width: min(100% - 18px, 580px);
    padding: 16px 0 28px;
  }

  .hero {
    gap: 18px;
    padding: 0 3px 18px;
  }

  h1 {
    font-size: clamp(40px, 13vw, 62px);
    overflow-wrap: anywhere;
  }

  .lead {
    min-width: 0;
    max-width: 25em;
    line-height: 1.55;
  }

  .hero-actions {
    width: 100%;
  }

  .support-chip {
    width: 100%;
    text-align: center;
  }

  .hero-actions .button {
    flex: 1;
  }

  .control-card,
  .comparison-card,
  .output-card {
    border-radius: 19px;
  }

  .panel-head {
    min-height: 70px;
    padding: 14px;
  }

  .panel-head--wide {
    flex-wrap: wrap;
  }

  .same-condition {
    width: 100%;
    margin-left: 53px;
  }

  .control-section {
    padding: 17px 14px;
  }

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

  .preset-grid button {
    min-height: 69px;
  }

  .color-pair {
    grid-template-columns: 1fr;
  }

  .pair-arrow {
    line-height: 1;
    text-align: center;
    transform: rotate(90deg);
  }

  .comparison-board {
    padding: 10px;
  }

  .mix-row {
    grid-template-columns: 1fr 62px;
    gap: 10px;
    min-height: 128px;
    padding: 11px;
  }

  .space-meta {
    grid-column: 1 / 2;
  }

  .gradient-track {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 48px;
  }

  .sample {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: 1fr;
    justify-items: end;
  }

  .sample code { display: none; }

  .sample > i {
    width: 46px;
    height: 46px;
  }

  .ratio-summary {
    grid-template-columns: 1fr 1fr;
  }

  .ratio-summary > div:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 1;
    border-bottom: 1px solid var(--line);
  }

  .ratio-summary > div:first-child {
    grid-column: 1;
    grid-row: 2;
  }

  .ratio-summary > div:last-child {
    grid-column: 2;
    grid-row: 2;
  }

  .output-grid {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .panel-head--dark {
    flex-wrap: wrap;
  }

  .button--coral {
    width: 100%;
    margin-left: 53px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
