/* ═══ 나의 녹음실 — dark studio theme ═══ */
:root {
  --bg: #131418;
  --card: #1c1e24;
  --card2: #24262e;
  --line: #2b2e37;
  --ink: #edeae4;
  --sub: #9aa0ab;
  --mut: #6c7280;
  --acc: #e0574f;
  --acc-dim: #b3453f;
  --acc-soft: rgba(224, 87, 79, 0.14);
  --r: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}
.app { max-width: 560px; margin: 0 auto; padding: 20px 16px 40px; }

/* ── header ── */
.top { padding: 6px 4px 14px; }
.top-row { display: flex; justify-content: space-between; align-items: center; }
.btn-help {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--sub); font: inherit; font-size: 15px; font-weight: 800;
}
.btn-help:active { color: var(--acc); border-color: var(--acc-dim); }
.logo { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; }
.logo-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 10px rgba(224,87,79,.6); }
.tagline { color: var(--mut); font-size: 12.5px; margin: 3px 0 0 21px; letter-spacing: 0.02em; }

/* ── tabs ── */
.tabs {
  display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 4px; position: sticky; top: 10px; z-index: 20;
}
.tab {
  flex: 1; padding: 9px 0; border: none; background: transparent; color: var(--sub);
  font: inherit; font-size: 14.5px; font-weight: 600; border-radius: 10px; cursor: pointer;
  transition: all .15s;
}
.tab.active { background: var(--card2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.tab.active::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--acc); margin-right: 7px; vertical-align: 2px; }

/* ── layout ── */
.panel { display: none; padding-top: 14px; }
.panel.active { display: block; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; margin-bottom: 12px;
}
.card h3 { font-size: 13px; font-weight: 700; color: var(--sub); letter-spacing: 0.06em; margin-bottom: 12px; text-transform: uppercase; }
.note { font-size: 12px; color: var(--mut); margin-top: 8px; }
.note.center { text-align: center; }
.hint { font-size: 13px; color: var(--mut); text-align: center; margin-top: 14px; }
.empty { text-align: center; color: var(--sub); padding: 60px 0; font-size: 15px; font-weight: 600; }
.empty span { font-size: 12.5px; color: var(--mut); font-weight: 400; }
.foot { text-align: center; color: var(--mut); font-size: 11px; padding: 18px 0 6px; letter-spacing: 0.04em; }

/* ── inputs ── */
input[type="text"], input[type="search"], textarea, select {
  width: 100%; background: var(--card2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 11px; padding: 10px 12px; font: inherit; font-size: 14px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--acc-dim); }
textarea { resize: vertical; }
label { font-size: 12.5px; color: var(--sub); font-weight: 600; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.field-row label { flex-shrink: 0; }
.field-row select { width: auto; min-width: 170px; }
.field-col { margin-bottom: 12px; }
.field-col label { display: block; margin-bottom: 6px; }

/* ── buttons ── */
button { font: inherit; cursor: pointer; }
.btn-primary {
  background: var(--acc); color: #fff; border: none; border-radius: 12px;
  padding: 11px 20px; font-size: 14px; font-weight: 700;
}
.btn-primary:active { background: var(--acc-dim); }
.btn-primary.wide { width: 100%; }
.btn-sub {
  background: var(--card2); color: var(--sub); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 16px; font-size: 13.5px; font-weight: 600;
}
.btn-sub.toggle.on { color: var(--acc); border-color: var(--acc-dim); background: var(--acc-soft); }
.btn-ghost { background: none; border: none; color: var(--sub); font-size: 13.5px; font-weight: 600; padding: 8px 10px; }
.btn-ghost.back { margin-bottom: 8px; }
.btn-ghost.wide { width: 100%; text-align: center; margin-top: 8px; }
.btn-danger { background: none; border: 1px solid #5a3232; color: #d97b74; border-radius: 12px; padding: 10px 16px; font-size: 13.5px; font-weight: 600; }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.btn-row.center { justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-grid .span2 { grid-column: 1 / -1; }

/* ── record tab ── */
.rec-main { text-align: center; padding: 22px 18px; }
.live-wave { width: 100%; height: 96px; display: block; }
.rec-time {
  font-size: 40px; font-weight: 800; letter-spacing: 0.02em; margin: 10px 0 16px;
  font-variant-numeric: tabular-nums;
}
.rec-btns { display: flex; align-items: center; justify-content: center; gap: 16px; }
.btn-rec {
  width: 74px; height: 74px; border-radius: 50%; border: 3px solid var(--line);
  background: var(--card2); display: flex; align-items: center; justify-content: center;
  transition: border-color .2s;
}
.btn-rec .rec-ic {
  width: 34px; height: 34px; background: var(--acc); border-radius: 50%;
  transition: all .2s; box-shadow: 0 0 14px rgba(224,87,79,.45);
}
.btn-rec.recording { border-color: var(--acc-dim); animation: pulse 1.6s ease-in-out infinite; }
.btn-rec.recording .rec-ic { border-radius: 7px; width: 26px; height: 26px; }
.btn-rec.paused { animation: none; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,87,79,.35); }
  50% { box-shadow: 0 0 0 12px rgba(224,87,79,0); }
}

#savePanel audio { width: 100%; margin-bottom: 14px; height: 40px; }

.loc-row { display: flex; gap: 8px; }
.loc-row input { flex: 1; }
.loc-row .btn-sub { flex-shrink: 0; white-space: nowrap; }

/* ── library ── */
.search-row { margin-bottom: 12px; }
#recList { list-style: none; }
#recList li {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 8px; cursor: pointer; transition: border-color .15s;
}
#recList li:hover { border-color: var(--acc-dim); }
.li-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.li-title { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-dur { font-size: 12.5px; color: var(--sub); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.li-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--sub); margin-top: 5px; flex-wrap: wrap; }
.li-loc::before { content: "📍"; font-size: 10px; margin-right: 2px; }
.li-memo { font-size: 12.5px; color: var(--mut); margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  font-size: 10.5px; font-weight: 700; color: var(--sub); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 6px; letter-spacing: 0.04em;
}
.badge.acc { color: var(--acc); border-color: var(--acc-dim); }

.title-input {
  background: none !important; border: none !important; font-size: 18px !important;
  font-weight: 800; padding: 0 0 4px !important; border-radius: 0 !important;
}
.meta-line { font-size: 12px; color: var(--mut); margin-bottom: 12px; }
.wave { width: 100%; height: 110px; display: block; background: var(--card2); border-radius: 10px; touch-action: none; cursor: crosshair; }
.time-line { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--sub); margin-top: 8px; font-variant-numeric: tabular-nums; }
.sel-info { color: var(--acc); font-weight: 600; }

/* ── studio ── */
.preset-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.preset-row button {
  background: var(--card2); border: 1px solid var(--line); color: var(--sub);
  border-radius: 10px; padding: 9px 4px; font-size: 12.5px; font-weight: 600;
}
.preset-row button:active { color: var(--acc); border-color: var(--acc-dim); }

.rate-row { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 12px; }
.rate-row .s-label { width: auto; }
.rate-row button {
  background: var(--card2); border: 1px solid var(--line); color: var(--sub);
  border-radius: 9px; padding: 6px 10px; font-size: 12px; font-weight: 600;
}
.rate-row button.on { color: var(--acc); border-color: var(--acc-dim); background: var(--acc-soft); }

.fx-head { display: flex; justify-content: space-between; align-items: center; }
.fx-head h3 { margin-bottom: 0; }
.fx .fx-body { margin-top: 12px; }
.slider-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.s-label { width: 68px; flex-shrink: 0; font-size: 12.5px; color: var(--sub); font-weight: 600; }
.s-val { width: 48px; flex-shrink: 0; text-align: right; font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); cursor: pointer; margin-top: 4px; }
.check-row input { accent-color: var(--acc); width: 16px; height: 16px; }

/* range */
input[type="range"] { flex: 1; appearance: none; -webkit-appearance: none; height: 4px; background: var(--line); border-radius: 2px; outline: none; }
input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: pointer;
}
input[type="range"]:active::-webkit-slider-thumb { background: var(--acc); }

/* switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: var(--card2); border: 1px solid var(--line);
  border-radius: 24px; transition: .2s; cursor: pointer;
}
.switch span::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: var(--sub); border-radius: 50%; transition: .2s;
}
.switch input:checked + span { background: var(--acc-soft); border-color: var(--acc-dim); }
.switch input:checked + span::before { transform: translateX(18px); background: var(--acc); }

/* modal */
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; width: 100%; max-width: 360px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.modal-box h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.modal-box input { margin-bottom: 4px; }
.help-box { max-width: 440px; max-height: 82vh; display: flex; flex-direction: column; }
.help-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.help-head h3 { margin-bottom: 0; font-size: 16px; }
.help-body { overflow-y: auto; padding-right: 4px; }
.help-body h4 { color: var(--acc); font-size: 13px; font-weight: 700; margin: 16px 0 6px; }
.help-body h4:first-child { margin-top: 0; }
.help-body p { font-size: 13px; color: var(--sub); margin-bottom: 6px; line-height: 1.6; }
.help-body b { color: var(--ink); font-weight: 700; }

/* toast */
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--card2); border: 1px solid var(--line); color: var(--ink);
  padding: 10px 20px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); z-index: 100; white-space: nowrap;
}

@media (max-width: 400px) {
  .rec-time { font-size: 34px; }
  .field-row select { min-width: 140px; }
}
