/* Retro wave (Dotto, 12-03): pixel art maker, 8-bit sound effects, chiptune maker. A pixel skin inside the handy.moe
   frame, after the kanji game's. Both themes. */
.rt {
  --rt-bg: #120e26; --rt-scr: #0a0818; --rt-ink: #fff1e8; --rt-dim: #a99fc4; --rt-line: #3b3363;
  --rt-pink: #ff77a8; --rt-cyan: #29adff; --rt-yel: #ffec27; --rt-grn: #00e436; --rt-red: #ff004d; --rt-org: #ffa300;
  position: relative; margin: 1.5rem 0 0; padding: 10px; color: var(--rt-ink); background: var(--rt-bg);
  border: 4px solid var(--rt-line); box-shadow: 0 0 0 4px #000, 8px 8px 0 4px #000; font-family: var(--f-term);
}
[data-theme="day"] .rt {
  --rt-bg: #f3e6c8; --rt-scr: #fff8ea; --rt-ink: #1d2b53; --rt-dim: #5f5470; --rt-line: #1d2b53;
  --rt-pink: #c2185b; --rt-cyan: #0b63b8; --rt-yel: #8a6d00; --rt-grn: #0a7a2a; --rt-red: #c0002e; --rt-org: #a85400;
  box-shadow: 8px 8px 0 0 rgba(29, 43, 83, .35);
}
.rt :focus-visible { outline: 3px solid var(--rt-yel); outline-offset: 2px; }
.rt input[type=number], .rt input[type=text], .rt select {
  font: inherit; font-size: 16px; color: var(--rt-ink); background: var(--rt-scr); border: 2px solid var(--rt-line); border-radius: 0; padding: 2px 4px; max-width: 100%;
}
.rt input[type=number] { width: 4.5em; }
.rt input[type=range] { accent-color: var(--rt-pink); max-width: 140px; }
.rt input[type=checkbox] { accent-color: var(--rt-pink); width: 18px; height: 18px; }
.rt .small { font-size: 14px; }
.px-b, .rt-b {
  font: inherit; font-size: 16px; line-height: 1.1; color: var(--rt-ink); background: var(--rt-scr); border: 2px solid var(--rt-line);
  box-shadow: 2px 2px 0 #000; padding: 6px 10px; min-height: 36px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
[data-theme="day"] .px-b, [data-theme="day"] .rt-b { box-shadow: 2px 2px 0 rgba(29, 43, 83, .5); }
.px-b:hover, .rt-b:hover { border-color: var(--rt-pink); color: var(--rt-pink); }
.px-b:active, .rt-b:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 #000; }
.px-b[aria-pressed="true"], .rt-b[aria-pressed="true"] { background: var(--rt-pink); border-color: var(--rt-pink); color: #000; }
.px-b.px-hot, .rt-b.hot { border-color: var(--rt-yel); color: var(--rt-yel); }
.rt-b.go { background: var(--rt-grn); border-color: var(--rt-grn); color: #000; }
.px-f { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; color: var(--rt-dim); min-height: 36px; }
.px-f.wide { display: flex; margin: 6px 0; }
.px-f output { color: var(--rt-yel); min-width: 2ch; }
.px-sp { flex: 1 1 0; }
.px-dim { color: var(--rt-dim); }
.px-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.px-row + .px-row { margin-top: 8px; }
.px-h { font-size: 16px; font-weight: 400; margin: 0 0 6px; color: var(--rt-yel); letter-spacing: .08em; text-transform: uppercase; }
.px-box { background: var(--rt-scr); border: 2px solid var(--rt-line); padding: 8px; min-width: 0; }

/* ---------- pixel art maker */
.px-top { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.px-tools { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.px-tool {
  flex: 0 0 auto; font: inherit; color: var(--rt-ink); background: var(--rt-scr); border: 2px solid var(--rt-line); box-shadow: 2px 2px 0 #000;
  width: 64px; height: 54px; display: grid; place-items: center; align-content: center; gap: 0; cursor: pointer; padding: 2px;
}
.px-tool span { font-size: 22px; line-height: 1; }
.px-tool small { font-size: 11px; line-height: 1.1; color: var(--rt-dim); white-space: nowrap; overflow: hidden; max-width: 100%; text-overflow: ellipsis; }
.px-tool[aria-pressed="true"] { background: var(--rt-pink); border-color: var(--rt-pink); color: #000; }
.px-tool[aria-pressed="true"] small { color: #000; }
.px-opts { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.px-main { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 8px; }
.px-left { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.px-stage {
  position: relative; overflow: auto; background: var(--rt-scr); border: 2px solid var(--rt-line); min-height: 240px; max-height: 70vh;
  display: grid; place-items: center; padding: 8px; touch-action: none;
}
.px-stage.over { border-color: var(--rt-yel); }
.px-stage canvas { display: block; image-rendering: pixelated; touch-action: none; margin: auto; box-shadow: 0 0 0 1px var(--rt-line); }
.px-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; color: var(--rt-dim); }
.px-status .px-b { min-height: 30px; padding: 2px 8px; }
.px-zoom { min-width: 3ch; text-align: center; color: var(--rt-ink); }
.px-sel { display: flex; flex-wrap: wrap; gap: 4px; }
.px-sel .px-b { font-size: 14px; min-height: 30px; padding: 2px 8px; }
.px-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.px-cols { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.px-sw { width: 30px; height: 30px; border: 2px solid var(--rt-ink); box-shadow: 2px 2px 0 #000; cursor: pointer; padding: 0; }
.px-sw.big { width: 40px; height: 40px; }
.px-sw.px-clear, .px-pal button.px-clear { background: repeating-conic-gradient(#999 0 25%, #fff 0 50%) 0 0 / 10px 10px !important; }
.rt input[type=color] { width: 36px; height: 30px; padding: 0; border: 2px solid var(--rt-line); background: none; }
.px-pal { display: grid; grid-template-columns: repeat(auto-fill, minmax(24px, 1fr)); gap: 3px; margin: 6px 0; }
.px-pal button { aspect-ratio: 1; min-height: 24px; border: 1px solid rgba(0,0,0,.4); padding: 0; cursor: pointer; }
.px-pal button[aria-pressed="true"] { outline: 3px solid var(--rt-yel); outline-offset: 0; z-index: 1; }
.px-by { font-size: 13px; color: var(--rt-dim); margin: 0 0 6px; line-height: 1.35; }
.px-box .px-row .px-b { font-size: 14px; padding: 4px 8px; min-height: 32px; }
.px-layers { list-style: none; margin: 0 0 4px; padding: 0; max-height: 170px; overflow-y: auto; }
.px-layers li { display: flex; gap: 4px; align-items: center; border: 2px solid transparent; }
.px-layers li.on { border-color: var(--rt-pink); }
.px-eye, .px-lname { font: inherit; font-size: 15px; color: var(--rt-ink); background: none; border: 0; cursor: pointer; padding: 4px; min-height: 32px; }
.px-eye { width: 32px; color: var(--rt-cyan); }
.px-lname { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.px-pv { display: grid; place-items: center; min-height: 140px; margin-bottom: 6px; background: repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%) 0 0 / 16px 16px; }
.px-pv canvas { image-rendering: pixelated; }
.px-time { margin-top: 8px; }
.px-frames { list-style: none; display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px; margin: 4px 0; }
.px-frames li button { position: relative; display: block; width: 64px; height: 64px; padding: 2px; cursor: pointer; border: 2px solid var(--rt-line); background: repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%) 0 0 / 8px 8px; }
.px-frames li.on button { border-color: var(--rt-pink); box-shadow: 0 0 0 2px var(--rt-pink); }
.px-frames canvas { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; display: block; }
.px-frames span { position: absolute; left: 1px; top: 0; font-size: 12px; background: var(--rt-scr); color: var(--rt-ink); padding: 0 3px; }
.px-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.px-open { cursor: pointer; }
@media (max-width: 860px) {
  .px-main { grid-template-columns: 1fr; }
  .px-grid2 { grid-template-columns: 1fr; }
  .px-stage { max-height: 62vh; }
}
@media (max-width: 420px) {
  .rt { padding: 6px; margin-left: -4px; margin-right: -4px; box-shadow: none; }
  .px-tool { width: 54px; height: 50px; }
}

/* ---------- 8-bit sound effects */
.sx-gens { display: flex; flex-wrap: wrap; gap: 6px; }
.sx-gens .rt-b { min-width: 92px; justify-content: center; font-size: 17px; min-height: 44px; }
.sx-wave { display: block; width: 100%; height: 120px; margin: 10px 0 6px; border: 2px solid var(--rt-line); background: var(--rt-scr); image-rendering: pixelated; }
.sx-bar { margin-top: 8px; }
.sx-sliders { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-top: 10px; }
.sx-g { border: 2px solid var(--rt-line); background: var(--rt-scr); margin: 0; padding: 4px 8px 8px; min-width: 0; }
.sx-g legend { color: var(--rt-yel); padding: 0 4px; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.sx-s { display: grid; grid-template-columns: 1fr minmax(80px, 120px) 3.2em; gap: 6px; align-items: center; font-size: 14px; color: var(--rt-dim); min-height: 30px; }
.sx-s input[type=range] { width: 100%; max-width: none; }
.sx-s output { color: var(--rt-ink); text-align: right; font-size: 13px; }
.sx-hh { margin-top: 12px; }
.sx-hist { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.sx-hist .rt-b { font-size: 14px; min-height: 30px; padding: 2px 8px; }

/* ---------- chiptune maker */
.ch > .px-row { margin-bottom: 8px; }
.ch-song { margin-bottom: 8px; }
.ch-order { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 4px 0 8px; }
.ch-order .rt-b { min-width: 44px; justify-content: center; font-size: 15px; min-height: 34px; padding: 2px 6px; }
.ch .px-box .px-row .rt-b { font-size: 14px; padding: 4px 8px; min-height: 32px; }
.ch-chans { gap: 6px; }
.ch-chan { display: inline-flex; gap: 2px; }
.ch-chan [data-chsel] { flex-direction: column; align-items: flex-start; gap: 0; min-width: 96px; }
.ch-chan [data-chsel] small { font-size: 12px; color: var(--rt-dim); }
.ch-chan [data-chsel][aria-pressed="true"] small { color: #000; }
.ch-c0[aria-pressed="true"] { background: var(--rt-pink); border-color: var(--rt-pink); }
.ch-c1[aria-pressed="true"] { background: var(--rt-cyan); border-color: var(--rt-cyan); }
.ch-c2[aria-pressed="true"] { background: var(--rt-grn); border-color: var(--rt-grn); }
.ch-c3[aria-pressed="true"] { background: var(--rt-org); border-color: var(--rt-org); }
.ch-m { padding: 6px 8px; }
.ch-m[aria-pressed="true"] { background: var(--rt-red); border-color: var(--rt-red); color: #fff; }
.ch-rollwrap { overflow: auto; max-height: 62vh; border: 2px solid var(--rt-line); background: var(--rt-scr); touch-action: pan-x pan-y; }
.ch-rollwrap canvas { display: block; cursor: pointer; }
.ch-trkwrap { border: 2px solid var(--rt-line); background: var(--rt-scr); padding: 4px; }
.ch-tk-head, .tk-row { display: grid; grid-template-columns: 2.6em repeat(4, minmax(10.5em, 1fr)); gap: 0 6px; font-size: 15px; white-space: nowrap; }
.ch-tk-head { color: var(--rt-yel); border-bottom: 2px solid var(--rt-line); padding: 2px 0; overflow: hidden; }
.ch-tracker { max-height: 60vh; overflow: auto; outline: none; font-variant-numeric: tabular-nums; }
.ch-tracker:focus-visible { outline: 3px solid var(--rt-yel); }
.ch-trkwrap { overflow-x: auto; }
.tk-row { line-height: 1.45; }
.tk-row.beat { background: rgba(127,127,127,.08); }
.tk-row.bar { background: rgba(127,127,127,.16); }
.tk-row.head { background: rgba(255,236,39,.25); }
.tk-n { color: var(--rt-dim); }
.tk-ch { display: flex; gap: 6px; }
.tk-ch.muted { opacity: .4; }
.tk-c { cursor: pointer; padding: 0 1px; }
.tk-c.cur { background: var(--rt-pink); color: #000; }
.ch-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.ch-seq { width: 100%; min-width: 0; flex: 1; font-size: 15px !important; }
@media (max-width: 860px) { .ch-grid2 { grid-template-columns: 1fr; } }
