/* dye.html: the 夢米 colour calculator (js/dye.js) */
.dye-spirits { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.dye-spirits button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; cursor: pointer;
  padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font: 13px var(--font-body);
}
.dye-spirits button span { font-size: 11px; color: var(--muted); }
.dye-spirits button[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.dye-stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 520px; }
.dye-stage { margin: 0; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; transition: opacity 0.2s; }
.dye-stage.dim { opacity: 0.45; }
.dye-stage figcaption { padding: 4px 0 8px; font-size: 12px; color: var(--muted); }
.dye-view { position: relative; height: 140px; perspective: 600px; overflow: hidden; }
/* The figure's feet sit at the element's origin */
.dye-spin { position: absolute; left: 50%; top: 86%; transform-style: preserve-3d; animation: dye-spin 14s linear infinite; }
@keyframes dye-spin { from { transform: rotateX(-12deg) rotateY(0); } to { transform: rotateX(-12deg) rotateY(360deg); } }
@media (prefers-reduced-motion: reduce) { .dye-spin { animation: none; transform: rotateX(-12deg) rotateY(-25deg); } }

.dye-parts { display: grid; gap: 10px; }
.dye-part, .dye-result { padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.dye-part h4, .dye-result h4 { margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; color: var(--heading); }
.dye-part h4 span, .dye-result h4 small { font-size: 11px; font-weight: 400; color: var(--muted); }
.dye-pick { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 10px; }
.dye-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dye-field input[type="color"] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
.dye-hex, .dye-food input {
  font: 13px var(--font-mono); color: var(--text); background: var(--code-bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px;
}
.dye-hex { width: 10ch; }
.dye-hex[aria-invalid] { border-color: #ff7a7a; }

.dye-bar { display: grid; grid-template-columns: 14px minmax(0, 1fr) 11ch; align-items: center; gap: 8px; margin: 6px 0; font-size: 11px; }
.dye-bar output { font: 11px var(--font-mono); color: var(--muted); white-space: nowrap; }
.dye-track { position: relative; height: 8px; border-radius: 4px; cursor: pointer; touch-action: none; }
/* A taller grab area than the 8px bar, under the markers */
.dye-track::after { content: ""; position: absolute; inset: -12px 0; }
.dye-track .m-from, .dye-track .m-to { z-index: 1; cursor: grab; }
.dye-track i:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dye-bar[data-ch="0"] .dye-track { background: linear-gradient(90deg, #000, #f00); }
.dye-bar[data-ch="1"] .dye-track { background: linear-gradient(90deg, #000, #0f0); }
.dye-bar[data-ch="2"] .dye-track { background: linear-gradient(90deg, #000, #00f); }
/* Markers: ▼ now above the bar, ◆ target on it, ● after feeding below it */
.dye-track i, .dye-legend i { display: inline-block; width: 10px; height: 10px; }
.dye-track i { position: absolute; margin-left: -5px; }
.dye-track i[hidden] { display: none; }
.m-from { clip-path: polygon(0 0, 100% 0, 50% 100%); background: var(--text); }
.dye-track .m-from { top: -11px; }
.m-to { transform: rotate(45deg) scale(0.8); background: #fff; outline: 2px solid #000; }
.dye-track .m-to { top: -1px; }
.m-out { border-radius: 50%; background: var(--gold); outline: 2px solid var(--bg); }
.dye-track .m-out { top: 11px; }
.dye-legend { display: flex; align-items: center; gap: 4px; }
.dye-legend i { vertical-align: middle; }

.dye-foods { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.dye-food { display: grid; grid-template-columns: 24px minmax(0, 1fr) 7ch; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.dye-food span { display: flex; flex-direction: column; font-size: 13px; }
.dye-food small { font-size: 10.5px; color: var(--muted); }
.dye-food input { width: 100%; box-sizing: border-box; }
.dye-ico { width: 24px; height: 24px; image-rendering: pixelated; vertical-align: middle; }

.dye-out { display: grid; gap: 10px; }
.dye-sw { display: inline-block; width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--line); }
.dye-steps { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 10px; padding: 0; list-style: none; }
.dye-steps li { font-size: 13px; white-space: nowrap; }
.dye-steps li + li::before { content: "→"; margin-right: 8px; color: var(--muted); }
.dye-steps li .dye-ico { margin-right: 4px; }
.dye-strip { display: flex; flex-wrap: wrap; gap: 2px; }
.dye-strip span { width: 16px; height: 16px; border-radius: 3px; }
.dye-strip span:first-child { margin-right: 6px; outline: 1px solid var(--line); }
.dye-total small { color: var(--muted); }
.dye-nowrap { white-space: nowrap; }
.dye-go:disabled { opacity: 0.6; cursor: progress; }
