@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 560;
  font-display: swap;
  src: url("/assets/fonts/fraunces-560.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 650;
  font-display: swap;
  src: url("/assets/fonts/fraunces-650.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/outfit-400.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/outfit-500.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/outfit-600.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #050508;
  --ink: #f6f1e8;
  --muted: rgba(246, 241, 232, 0.66);
  --line: rgba(255, 255, 255, 0.16);
  --panel: rgba(12, 12, 16, 0.78);
  --accent: #e7c98a;
  --danger: #ffb4a8;
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Outfit", sans-serif;
}

body[data-theme="paper"] {
  color-scheme: light;
  --bg: #f4efe6;
  --ink: #241c16;
  --muted: rgba(36, 28, 22, 0.66);
  --line: rgba(36, 28, 22, 0.16);
  --panel: rgba(255, 250, 244, 0.82);
  --accent: #8c3b2c;
  --danger: #8c3b2c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.hint {
  position: fixed;
  top: 84px;
  left: 50%;
  z-index: 2;
  margin: 0;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  pointer-events: none;
  text-align: center;
  transition: opacity 0.4s ease;
}

body.is-drawing .hint {
  opacity: 0;
}

.topbar,
.dock {
  position: fixed;
  z-index: 3;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.topbar {
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 16px;
}

.back {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.back:hover,
.back:focus-visible {
  color: var(--ink);
}

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

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 560;
  letter-spacing: -0.02em;
}

#palette-name {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.top-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  margin-left: auto;
}

.top-actions button,
.controls button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  padding: 8px 14px;
}

.top-actions button:hover,
.controls button:hover,
.top-actions button:focus-visible,
.controls button:focus-visible,
.swatch:focus-visible,
.palette-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

.dock {
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
}

.swatches,
.palettes,
.controls,
.palette-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.palette-row {
  justify-content: space-between;
}

.palette-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.swatch,
.palette-dot {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--swatch, #fff);
}

.swatch[aria-selected="true"],
.palette-dot[aria-selected="true"] {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--bg);
}

.palette-dot {
  width: 18px;
  height: 18px;
}

.palette-dot.is-today {
  box-shadow: 0 0 0 1px var(--accent);
}

.readouts {
  display: flex;
  gap: 12px;
}

.copies {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.controls {
  align-items: end;
}

.slider {
  display: grid;
  gap: 4px;
  min-width: 140px;
  flex: 1 1 160px;
  color: var(--muted);
  font-size: 0.85rem;
}

.slider output {
  color: var(--ink);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    gap: 8px;
  }

  .top-actions button {
    white-space: nowrap;
    padding: 8px 10px;
  }

  h1 {
    font-size: 1.15rem;
  }

  .hint {
    top: 96px;
    width: min(280px, calc(100% - 48px));
  }
}
