
/* ------------------------------------------------------------
   Centre — composer
   ------------------------------------------------------------ */

.pane-main .pane-body {
  display: flex;
  flex-direction: column;
  padding: 20px 24px 20px;
  gap: 14px;
}

.picked {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.picked-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--signal-lo);
  border: 1px solid var(--signal-mid);
  color: var(--signal);
}
.picked-name { font-weight: 500; }
.picked-sum { font-size: 12.5px; color: var(--muted); }
.picked-none .picked-mark { background: var(--panel-hi); border-color: var(--line); color: var(--dim); }
.picked-none .picked-name { color: var(--muted); font-weight: 400; }

.composer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 0.18s;
}
.composer:focus-within { border-color: var(--line-hi); }

.composer textarea {
  flex: 1;
  min-height: 150px;
  width: 100%;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  padding: 16px 18px;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text);
}
.composer textarea::placeholder { color: var(--dim); }

.composer-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel-in);
}
.count {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--dim);
}
.count.is-over { color: var(--err); }
.foot-spacer { flex: 1; }

.hint {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.04em;
}
kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 5px;
  border: 1px solid var(--line-hi);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--muted);
}

/* The one primary action on the screen. Nothing else gets this treatment. */
.go {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 20px;
  border: 0;
  border-radius: var(--r);
  background: var(--signal);
  color: #1a1206;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.18s, filter 0.16s;
  box-shadow: 0 2px 14px rgba(255, 158, 44, 0.24);
}
.go:hover:not(:disabled) {
  filter: brightness(1.07);
  box-shadow: 0 4px 22px rgba(255, 158, 44, 0.34);
}
.go:active:not(:disabled) { transform: translateY(1px); }
.go:disabled {
  background: var(--panel-hi);
  color: var(--dim);
  box-shadow: none;
  cursor: not-allowed;
}

.adv {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  overflow: hidden;
}
.adv summary {
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.adv summary::-webkit-details-marker { display: none; }
.adv summary:hover { color: var(--text-soft); }
.adv summary .caret { transition: transform 0.2s; color: var(--dim); }
.adv[open] summary .caret { transform: rotate(90deg); }
.adv-body {
  padding: 4px 14px 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 14px;
  border-top: 1px solid var(--line);
}
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 6px;
}
.field select,
.field input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--panel-in);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  outline: none;
}
.field select:focus,
.field input:focus { border-color: var(--signal-mid); }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--signal); }
.range-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-soft);
  min-width: 22px;
  text-align: right;
}

/* ------------------------------------------------------------
   Right — result + history
   ------------------------------------------------------------ */

.pane-result .pane-body { padding: 14px; }

.stage {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  padding: 16px;
  margin-bottom: 16px;
}
.stage-idle {
  text-align: center;
  color: var(--dim);
  padding: 30px 16px;
  font-size: 13px;
  border-style: dashed;
}

/* Working state — bars that actually move, so waiting reads as "running"
   rather than "stuck". */
.wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 46px;
  margin-bottom: 12px;
}
.wave i {
  width: 3px;
  border-radius: 2px;
  background: var(--signal);
  opacity: 0.85;
  animation: wv 1.05s ease-in-out infinite;
}
@keyframes wv {
  0%, 100% { height: 18%; }
  50%      { height: 100%; }
}

.prog {
  height: 3px;
  background: var(--panel-hi);
  border-radius: 99px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  width: 0%;
  background: var(--signal);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.stage-msg {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}
.stage-err {
  color: var(--err);
  font-size: 13px;
  text-align: center;
}

audio { width: 100%; margin-top: 4px; }

.result-acts {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.btn-quiet {
  flex: 1;
  padding: 8px 12px;
  background: var(--panel-hi);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  text-decoration: none;
  transition: border-color 0.16s, color 0.16s;
}
.btn-quiet:hover { border-color: var(--line-hi); color: var(--text); }

.hist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 6px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.14s;
}
.hist-item:hover { border-color: var(--line-hi); }
.hist-play {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 99px;
  border: 1px solid var(--line-hi);
  color: var(--text-soft);
}
.hist-text {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hist-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  flex: 0 0 auto;
}

/* ประวัติที่ยังไม่มีอะไร และรายการที่เล่นไม่ได้ (งานล้มเหลว/ไม่มีไฟล์เสียง) */
.hist-empty {
  padding: 12px 10px;
  font-size: 12.5px;
  color: var(--dim);
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
}
.hist-item.is-gone {
  cursor: default;
  opacity: 0.55;
}
.hist-item.is-gone:hover { border-color: var(--line); }

/* ------------------------------------------------------------
   Responsive — collapse the console into one column
   ------------------------------------------------------------ */

@media (max-width: 1180px) {
  :root { --rail-w: 250px; --result-w: 290px; }
}

@media (max-width: 960px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .panes { grid-template-columns: 1fr; }
  .pane-rail, .pane-result { border: 0; border-top: 1px solid var(--line); }
  .pane-body { overflow: visible; }
  .composer textarea { min-height: 190px; }

  /* Cloning is step-ordered: record first, then write, then listen.
     Keep source order on narrow screens - no order overrides. */
  .pane-rail { order: 1; }
  .pane-main { order: 2; }
  .pane-result { order: 3; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .brand-sub { display: none; }
  .pane-main .pane-body { padding: 14px; }
  .go { width: 100%; justify-content: center; }
  .composer-foot { flex-wrap: wrap; }
  .hint { display: none; }
}
