/* 调墨
   宣纸、清水、矿物色。颜色在水里按颜料的方式相减。 */

:root {
  --ink: #1c1914;
  --muted: #7a6a58;
  --paper: #f4f9fd;
  --sand: rgba(255, 255, 255, 0.78);
  --brush: "Montserrat", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  color: var(--ink);
  font-family: var(--brush);
  font-weight: 400;
  background: var(--paper);
  user-select: none;
  -webkit-user-select: none;
}

button, input { font-family: inherit; }

::selection {
  background: #e7c3b0;
  color: var(--ink);
}

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

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
  background: var(--paper);
}

.mast {
  position: fixed;
  z-index: 2;
  top: max(22px, env(safe-area-inset-top));
  left: max(26px, env(safe-area-inset-left));
  pointer-events: none;
}

.eyebrow {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-shadow: 0 0 16px var(--paper), 0 1px 0 var(--paper);
}

h1 {
  margin: 0;
  font-family: var(--brush);
  font-weight: 500;
  font-size: 60px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-shadow: 0 0 18px var(--paper), 0 1px 0 var(--paper);
}

.lede {
  margin: 8px 0 0;
  max-width: none;
  font-size: 15px;
  line-height: 1.35;
  white-space: nowrap;
  color: var(--muted);
  text-shadow: 0 0 14px var(--paper);
  transition: opacity 0.7s ease;
}

.lede.is-gone { opacity: 0; }

.dock {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 22px;
  width: max-content;
  max-width: calc(100vw - 28px);
  padding: 18px 22px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.34);
  -webkit-backdrop-filter: blur(42px) saturate(1.85);
  backdrop-filter: blur(42px) saturate(1.85);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 34px rgba(40, 70, 100, 0.14);
}

.palette {
  display: flex;
  gap: 10px;
}

.swatch {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0.5px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;
  background:
    radial-gradient(circle at 32% 26%, #fff 0 6%, rgba(255, 255, 255, 0.35) 14%, transparent 34%),
    radial-gradient(circle at 74% 80%, rgba(255, 255, 255, 0.7) 0 4%, transparent 18%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.02) 64%, rgba(176, 206, 226, 0.28));
  box-shadow:
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.7),
    inset 0 8px 10px rgba(255, 255, 255, 0.45),
    inset 0 -10px 12px rgba(160, 190, 214, 0.28),
    0 8px 14px rgba(70, 110, 140, 0.16);
}

.swatch .blob {
  position: absolute;
  left: 16%;
  top: 18%;
  width: 66%;
  height: 58%;
  border-radius: 62% 38% 58% 42% / 46% 64% 36% 54%;
  background-color: var(--c);
  background-image: url("assets/ink-grain.png");
  background-size: 42px;
  background-blend-mode: multiply;
  -webkit-mask-image: radial-gradient(ellipse at 42% 46%, #000 28%, transparent 74%);
  mask-image: radial-gradient(ellipse at 42% 46%, #000 28%, transparent 74%);
}

.swatch .blob::before,
.swatch .blob::after {
  content: "";
  position: absolute;
  background-color: var(--c);
  background-image: url("assets/ink-grain.png");
  background-size: 36px;
  background-blend-mode: multiply;
  filter: blur(1.4px);
}

.swatch .blob::before {
  width: 78%;
  height: 62%;
  left: -22%;
  top: 28%;
  border-radius: 50% 40% 60% 46%;
  opacity: 0.72;
}

.swatch .blob::after {
  width: 48%;
  height: 70%;
  right: -18%;
  top: -16%;
  border-radius: 42% 58% 48% 52%;
  opacity: 0.5;
}

.swatch::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.55), transparent 34% 68%, rgba(255, 255, 255, 0.28));
}

.swatch[aria-checked="true"] {
  box-shadow:
    inset 0 7px 8px rgba(255, 255, 255, 0.5),
    inset 0 -8px 10px rgba(150, 180, 205, 0.22),
    0 0 0 2px rgba(255, 255, 255, 0.92),
    0 8px 16px rgba(70, 110, 140, 0.22);
}

.swatch:hover {
  transform: translateY(-1px);
}

.modes {
  display: flex;
  gap: 8px;
}

.modes button,
.wash {
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.28);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0.01em;
  line-height: 1;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.modes button.mix {
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mix svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mix svg circle {
  fill: currentColor;
  stroke: none;
}

.mix[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 2px rgba(40, 70, 100, 0.08);
}

.meters {
  display: flex;
  align-items: center;
  gap: 22px;
}

.slider {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
}

.slider span {
  width: auto;
}

.slider input {
  -webkit-appearance: none;
  appearance: none;
  width: 112px;
  height: 4px;
  margin: 0;
  border-radius: 99px;
  background: rgba(28, 25, 20, 0.16);
  cursor: pointer;
}

.slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 1px 4px rgba(40, 70, 100, 0.28), 0 0 0 0.5px rgba(255, 255, 255, 0.8);
}

.slider input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(40, 70, 100, 0.28);
}

.modes button:hover {
  background: rgba(255, 255, 255, 0.48);
}

.wash {
  background: #5eb6e8;
  color: #fff;
  font-weight: 600;
  border-color: transparent;
  box-shadow: none;
}

.wash:hover {
  background: #4aa8df;
}

.fallback {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  margin: 0;
  background: var(--paper);
  color: var(--muted);
  letter-spacing: 0.08em;
}

.fallback[hidden] { display: none; }

@media (max-width: 760px) {
  .mast { left: 18px; }
  h1 { font-size: 60px; }
  .dock {
    width: calc(100vw - 20px);
    border-radius: 100px;
  }
  .slider input { width: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  .lede { transition: none; }
  .modes button:hover { background: rgba(255, 255, 255, 0.28); }
  .wash:hover { background: #5eb6e8; }
  .swatch:hover { transform: none; }
}
