:root {
  --bg: #0d0f16;
  --bg2: #141826;
  --panel: #171c2b;
  --panel2: #1e2436;
  --line: #2a3145;
  --fg: #e9ecf5;
  --dim: #9aa3bd;
  --accent: #7c5cff;
  --accent2: #4fd1ff;
  --ok: #8affc1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 700px at 15% -10%, #221a4a 0%, transparent 60%),
              radial-gradient(900px 600px at 100% 0%, #103247 0%, transparent 55%),
              var(--bg);
  color: var(--fg);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  min-height: 100vh;
}

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 15, 22, .6);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 22px rgba(124, 92, 255, .45);
}
.top h1 { margin: 0; font-size: 19px; letter-spacing: .04em; }
.top p { margin: 2px 0 0; font-size: 12px; color: var(--dim); }
.topActions { display: flex; gap: 8px; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  gap: 18px;
  padding: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.controls { padding: 4px 0; max-height: calc(100vh - 110px); overflow-y: auto; }
.player { position: sticky; top: 92px; }
@media (max-width: 900px) {
  .controls { max-height: none; }
  .player { position: static; }
}

.block { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: none; }
.block h2 {
  margin: 0 0 12px; font-size: 12px; letter-spacing: .14em;
  color: var(--dim); text-transform: uppercase; font-weight: 700;
}

/* ---------- keyword ---------- */
.kwRow { display: flex; gap: 8px; }
.kwRow input {
  flex: 1; min-width: 0;
  background: var(--panel2); border: 1px solid var(--line); color: var(--fg);
  border-radius: 10px; padding: 10px 12px; font-size: 13px;
}
.kwRow input:focus { outline: none; border-color: var(--accent); }
.kwHint { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 11px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: rgba(124, 92, 255, .14); border: 1px solid rgba(124, 92, 255, .35);
  color: #cdc4ff;
}
.tag:hover { background: rgba(124, 92, 255, .3); }

/* ---------- presets ---------- */
.presetGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.presetBtn {
  background: var(--panel2); border: 1px solid var(--line); color: var(--fg);
  border-radius: 12px; padding: 10px 6px; cursor: pointer;
  display: grid; gap: 4px; justify-items: center;
  transition: .15s;
}
.presetBtn:hover { border-color: var(--accent2); transform: translateY(-1px); }
.presetBtn.on {
  background: linear-gradient(135deg, rgba(124, 92, 255, .35), rgba(79, 209, 255, .25));
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(124, 92, 255, .5) inset;
}
.pIcon { font-size: 20px; }
.pName { font-size: 11px; line-height: 1.2; text-align: center; }
.desc { margin: 10px 0 0; font-size: 12px; color: var(--dim); min-height: 2.4em; }

/* ---------- controls ---------- */
.ctl {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 12px;
}
.ctl label { font-size: 12px; color: var(--dim); grid-column: 1; }
.ctl input[type=range] { grid-column: 1; width: 100%; }
.ctl output {
  grid-column: 2; grid-row: 2;
  font-size: 12px; font-variant-numeric: tabular-nums;
  min-width: 48px; text-align: right; color: var(--fg);
}
.unit { font-size: 10px; opacity: .7; }

.ctl2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.ctl2 label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 4px; }
select, .seedRow input {
  width: 100%; background: var(--panel2); border: 1px solid var(--line);
  color: var(--fg); border-radius: 9px; padding: 8px 10px; font-size: 13px;
}
select:focus, input:focus { outline: none; }
.seedRow { display: flex; gap: 6px; }
.seedRow input { flex: 1; min-width: 0; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  height: 5px; border-radius: 5px; background: var(--panel2);
  border: 1px solid var(--line);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  cursor: pointer; border: 2px solid #0d0f16;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid #0d0f16;
  background: var(--accent); cursor: pointer;
}

/* ---------- parts ---------- */
.partList { display: grid; gap: 8px; }
.partRow {
  display: grid; grid-template-columns: 1fr 110px; align-items: center; gap: 10px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px;
}
.partRow.off { opacity: .45; }
.partRow.unavail { display: none; }
.chk { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.chk input { display: none; }
.chk .box {
  width: 17px; height: 17px; border-radius: 5px;
  border: 1px solid var(--line); background: #0f1320; flex: none;
  position: relative;
}
.chk input:checked + .box {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
}
.chk input:checked + .box::after {
  content: "✓"; position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 12px; color: #0d0f16; font-weight: 900;
}
.mix { width: 100%; }

/* ---------- buttons ---------- */
button {
  font-family: inherit;
  cursor: pointer;
}
.accent {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0d0f16; font-weight: 800; border: none;
  border-radius: 11px; padding: 10px 18px; font-size: 13px;
  box-shadow: 0 6px 18px rgba(124, 92, 255, .35);
  transition: .15s;
}
.accent:hover { filter: brightness(1.08); transform: translateY(-1px); }
.accent:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.accent.big { width: 100%; padding: 16px; font-size: 15px; border-radius: 13px; letter-spacing: .04em; }
.small { padding: 8px 12px; font-size: 12px; }
.ghost {
  background: var(--panel2); border: 1px solid var(--line); color: var(--fg);
  border-radius: 10px; padding: 8px 12px; font-size: 12px;
}
.ghost:hover { border-color: var(--accent2); }

/* ---------- player ---------- */
.playerInner { padding: 18px; display: grid; gap: 16px; }
.genBox { display: grid; gap: 10px; }
.status { font-size: 12px; color: var(--dim); text-align: center; min-height: 1.4em; }
.status.busy { color: var(--accent2); }
.status.busy::after {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px;
  border-radius: 50%; background: var(--accent2);
  animation: pulse .9s infinite ease-in-out;
}
@keyframes pulse { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

.waveWrap {
  position: relative; background: #0b0e17; border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; height: 180px;
}
#wave { display: block; width: 100%; height: 180px; cursor: pointer; }

.transport {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.round {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--panel2); border: 1px solid var(--line);
  color: var(--fg); font-size: 15px;
}
.round:hover:not(:disabled) { border-color: var(--accent2); }
.round:disabled { opacity: .35; cursor: not-allowed; }
.round.on {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0d0f16; border-color: transparent;
}
.timeBox { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--dim); }
.volBox { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.volBox input { width: 100px; }

/* ---------- info ---------- */
.info { display: grid; gap: 6px; }
.infoRow {
  display: grid; grid-template-columns: 96px 1fr; gap: 10px;
  font-size: 12px; padding: 7px 10px;
  background: var(--panel2); border-radius: 8px; border: 1px solid var(--line);
}
.infoRow .k { color: var(--dim); }
.infoRow .v { color: var(--fg); font-variant-numeric: tabular-nums; }

.tips { border-top: 1px solid var(--line); padding-top: 14px; }
.tips h3 { margin: 0 0 8px; font-size: 12px; color: var(--dim); letter-spacing: .1em; }
.tips ul { margin: 0; padding-left: 18px; font-size: 12px; color: var(--dim); line-height: 1.8; }
.tips strong { color: var(--fg); }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(5, 6, 12, .75);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal[hidden] { display: none; }
.modalBox {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; max-width: 560px; width: 100%;
}
.modalBox h2 { margin: 0 0 12px; font-size: 17px; }
.modalBox h3 { margin: 18px 0 6px; font-size: 13px; color: var(--accent2); }
.modalBox ol { padding-left: 20px; line-height: 2; font-size: 13px; color: var(--dim); }
.modalBox p { font-size: 13px; color: var(--dim); line-height: 1.8; }
.kwList { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--dim); line-height: 1.9; }
.kwList strong { color: var(--accent2); }
.modalBox strong { color: var(--fg); }
.modalBox button { margin-top: 16px; }

/* scrollbar */
.controls::-webkit-scrollbar { width: 10px; }
.controls::-webkit-scrollbar-thumb { background: var(--panel2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
