:root {
  --bg: #12122a;
  --bg2: #1c1b3a;
  --ink: #ece7dc;
  --muted: #9d97be;
  --accent: #d4af37;
  --accent2: #ffd77a;
  --line: #ffffff1f;
}
* {
  box-sizing: border-box;
}
html {
  color: var(--ink);
  background: var(--bg)
    radial-gradient(circle at 50% 0%, #2a2456 0%, #12122a 55%, #0b0b18 100%)
    fixed;
  scroll-behavior: smooth;
  min-height: 100%;
}
html,
button,
select,
input {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: 16px;
}
body {
  margin: 0;
  padding: 0 0 40px;
}
h1,
h2,
h3 {
  font-weight: normal;
  margin: 0;
}
a {
  color: var(--muted);
  transition: color 0.4s;
}
a:hover {
  color: var(--accent2);
}

#header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 20px 8px;
  background: #12122ae6;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
#header h1 {
  display: inline-block;
  font-size: 22px;
  letter-spacing: 0.04em;
  margin-right: 20px;
}
#header h1 > span {
  color: var(--accent);
}
#header .links {
  float: right;
  padding-top: 6px;
  font-size: 14px;
}
#header .links > a {
  margin-left: 16px;
  text-decoration: none;
}

.intro {
  max-width: 1180px;
  margin: 20px auto 0;
  padding: 0 20px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  max-width: 1180px;
  margin: 16px auto 0;
  padding: 0 20px;
}

/* --- canvas --- */
.canvas-wrap {
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
  /* a checkerboard shows through a transparent canvas */
  background-color: #888;
  background-image:
    linear-gradient(45deg, #777 25%, transparent 25%, transparent 75%, #777 75%),
    linear-gradient(45deg, #777 25%, transparent 25%, transparent 75%, #777 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}
#mandala {
  display: block;
  width: 100%;
  touch-action: none;
  cursor: crosshair;
}
.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}
.btns button {
  flex: 1;
  min-width: 84px;
  padding: 9px 10px;
  color: var(--ink);
  background: #ffffff0f;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition:
    background 0.3s,
    color 0.3s,
    border-color 0.3s;
}
.btns button:hover {
  color: var(--accent2);
  border-color: #ffd77a66;
  background: #ffffff1a;
}

/* --- side panel --- */
.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #00000026;
  padding: 14px 18px 16px;
  margin: 0 0 16px;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.ctl {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  margin: 0 0 12px;
  font-size: 14px;
}
.ctl label {
  color: var(--muted);
}
.ctl .val {
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}
.ctl input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 4px 0 0;
}
.opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.opt input {
  width: 1.1em;
  height: 1.1em;
  accent-color: var(--accent);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.chips button {
  margin: 0;
  line-height: 1.2;
  padding: 6px 12px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  transition:
    color 0.3s,
    border-color 0.3s,
    background 0.3s;
}
.chips button:hover {
  color: var(--accent2);
  border-color: #ffd77a66;
}
.chips button.selected,
.chips button[aria-pressed="true"] {
  color: #12122a;
  background: var(--accent);
  border-color: var(--accent);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  border: 2px solid #ffffff59;
  cursor: pointer;
}
.swatch:hover,
.swatch:focus {
  border-color: white;
}
.swatch.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #1c1b3a, 0 0 0 4px var(--accent);
}
.swatch-custom {
  position: relative;
  overflow: hidden;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
}
.swatch-custom input {
  position: absolute;
  inset: -6px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  opacity: 0;
  cursor: pointer;
}

.note {
  max-width: 1180px;
  margin: 20px auto 0;
  padding: 0 20px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.footer {
  max-width: 1180px;
  margin: 30px auto 0;
  padding: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.footer a {
  color: var(--accent2);
}

@media only screen and (max-width: 860px) {
  main {
    grid-template-columns: 1fr;
  }
  #header h1 {
    font-size: 19px;
  }
  #header .links {
    float: none;
    display: block;
    padding: 4px 0 0;
  }
}
