:root {
  --bg: #faf5ef;
  --bg-soft: #f3ebe0;
  --card: #ffffff;
  --ink: #3b322d;
  --ink-soft: #8a7d72;
  --gold: #c39a5a;
  --gold-deep: #a37f42;
  --rose: #c98b8b;
  --line: #e8dccd;
  --ok: #6ba368;
  --shadow: 0 10px 30px rgba(90, 70, 45, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 90% at 50% 0%, #fffaf3 0%, var(--bg) 55%, var(--bg-soft) 100%);
  min-height: 100vh;
  line-height: 1.5;
}

.serif { font-family: Georgia, "Times New Roman", serif; }

.wrap { max-width: 640px; margin: 0 auto; padding: 22px 18px 90px; }

/* --- шапка --- */
.hero { text-align: center; padding: 26px 0 14px; }
.hero .rings { font-size: 30px; letter-spacing: 4px; }
.hero h1 {
  font-family: Georgia, serif; font-weight: 500; margin: 8px 0 4px;
  font-size: 30px; letter-spacing: 0.3px;
}
.hero p { color: var(--ink-soft); margin: 0; font-size: 15px; }
.divider {
  width: 60px; height: 1px; background: var(--gold);
  margin: 16px auto; position: relative;
}
.divider::before {
  content: "❦"; color: var(--gold); position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%); background: var(--bg); padding: 0 8px;
}

/* --- вкладки --- */
.tabs { display: flex; gap: 8px; margin: 6px 0 18px; }
.tab {
  flex: 1; padding: 12px; border: 1px solid var(--line); background: var(--card);
  border-radius: 12px; font-size: 15px; color: var(--ink-soft); cursor: pointer;
  transition: .15s; text-align: center;
}
.tab.active { color: var(--ink); border-color: var(--gold); background: #fff; box-shadow: var(--shadow); font-weight: 600; }

/* --- поля --- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--ink-soft); }
input[type=text], textarea {
  width: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 16px; background: #fff; color: var(--ink); font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; min-height: 70px; }

.searchbar { display: flex; gap: 8px; }
.searchbar input { flex: 1; }

/* --- кнопки --- */
.btn {
  border: none; border-radius: 12px; padding: 13px 18px; font-size: 15px;
  cursor: pointer; font-family: inherit; transition: .15s; font-weight: 600;
}
.btn-gold { background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: #fff; }
.btn-gold:active { transform: translateY(1px); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-block { width: 100%; }

/* --- карточки результатов --- */
.results { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.song {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow);
}
.song img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: var(--bg-soft); flex: none; }
.song .meta { flex: 1; min-width: 0; }
.song .meta b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .meta span { font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.song .actions { display: flex; gap: 6px; flex: none; }
.iconbtn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; font-size: 17px; cursor: pointer; display: grid; place-items: center; color: var(--ink);
}
.iconbtn.play.playing { background: var(--gold); color: #fff; border-color: var(--gold); }
.iconbtn.add { background: var(--ok); color: #fff; border-color: var(--ok); }
.iconbtn.add.done { background: #cfe6cd; color: #4a6b48; }

/* --- список "моё" --- */
.mine { margin-top: 22px; }
.mine h3 { font-family: Georgia, serif; font-weight: 500; font-size: 17px; margin: 0 0 8px; }
.mine ul { list-style: none; padding: 0; margin: 0; }
.mine li {
  padding: 10px 12px; background: #fffdf9; border: 1px dashed var(--line);
  border-radius: 10px; margin-bottom: 6px; font-size: 14px; display: flex; gap: 8px; align-items: center;
}
.mine li::before { content: "♪"; color: var(--gold); }

/* --- запись голоса --- */
.recorder { text-align: center; padding: 8px 0; }
.rec-circle {
  width: 96px; height: 96px; border-radius: 50%; margin: 12px auto; border: none;
  background: linear-gradient(180deg, var(--rose), #b57575); color: #fff; font-size: 34px;
  cursor: pointer; box-shadow: var(--shadow); transition: .15s;
}
.rec-circle.recording { animation: pulse 1.2s infinite; background: #d05a5a; }
@keyframes pulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(208,90,90,.4);} 50%{ box-shadow: 0 0 0 16px rgba(208,90,90,0);} }
.rec-time { font-size: 22px; font-family: Georgia, serif; color: var(--ink); min-height: 26px; }
.rec-hint { color: var(--ink-soft); font-size: 14px; margin: 4px 0 0; }
audio { width: 100%; margin-top: 10px; }

/* --- тосты --- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(30px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 30px; font-size: 14px;
  opacity: 0; transition: .3s; z-index: 50; box-shadow: var(--shadow); max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #b04a4a; }

.hidden { display: none !important; }
.muted { color: var(--ink-soft); font-size: 14px; text-align: center; padding: 10px; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid #fff6; border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -3px; }
@keyframes rot { to { transform: rotate(360deg); } }

/* --- футер --- */
.foot { text-align: center; color: var(--ink-soft); font-size: 12px; margin-top: 30px; }
