/* Song Lyrics — золотой глянец · выверенная сетка и ритм */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
/* запрет горизонтальной прокрутки и «разлома» страницы пальцами */
html, body { overflow-x: hidden; }
body { touch-action: pan-y; overscroll-behavior: none; }
button, a, input, textarea, select { touch-action: manipulation; }

:root {
  /* палитра */
  --bg: #f8f3e8; --bg-2: #f0e8d7;
  --card: #fffdf7; --card-2: #f7f0e1;
  --text: #2b2118; --muted: #8a7a63;
  --line: #e7ddc7; --line-2: #f0e7d3;
  --gold-1: #8a5a12; --gold-2: #c9a227; --gold-3: #f0d878;
  --accent: #a97e1f;
  --searchbar: #fffdf7;
  --tabbar: #fffdf7; --tabbar-opacity: .92; --tabbar-h: 64px;
  --font-scale: 1;
  --ok: #2e7d4f; --ok-soft: rgba(46,125,79,.12);
  --danger: #b3372f; --danger-soft: rgba(179,55,47,.1);
  /* тени — мягкие, слоистые */
  --shadow: 0 1px 2px rgba(96,64,18,.05), 0 8px 24px -12px rgba(96,64,18,.18);
  --shadow-2: 0 2px 6px rgba(96,64,18,.07), 0 18px 40px -16px rgba(96,64,18,.28);
  /* радиусы — единая система */
  --r-sm: 12px; --r-md: 16px; --r-lg: 20px;
  --hdr-h: 60px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.22,.61,.36,1);
  --serif: Georgia, 'Times New Roman', 'PT Serif', serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.dark {
  --bg: #171310; --bg-2: #100d0a;
  --card: #211a15; --card-2: #2a211a;
  --text: #f0e7d8; --muted: #a89880;
  --line: #38302a; --line-2: #2c251f;
}
body {
  font-family: var(--sans);
  font-size: 15px; line-height: 1.55; color: var(--text);
  background:
    radial-gradient(130% 46% at 50% -10%, color-mix(in srgb, var(--gold-2) 13%, transparent), transparent 62%),
    radial-gradient(90% 30% at 50% 108%, color-mix(in srgb, var(--gold-2) 7%, transparent), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
img { user-select: none; -webkit-user-drag: none; }
.ic { width: 20px; height: 20px; flex: 0 0 auto; }
.ic.sm { width: 16px; height: 16px; }
.ic.md { width: 22px; height: 22px; }
.ic.lg { width: 30px; height: 30px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.wrap { padding: 0 16px; }
::selection { background: color-mix(in srgb, var(--gold-2) 35%, transparent); }

/* ============================================================ ШАПКА */
.header {
  position: sticky; top: 0; z-index: 40; padding-top: var(--sat);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(18px) saturate(170%); -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-bottom: 1px solid var(--line);
}
.header-in {
  display: flex; align-items: center; gap: 10px;
  height: var(--hdr-h); padding: 0 14px;
  max-width: 720px; margin: 0 auto;
}
.logo-mark {
  width: 40px; height: 40px; border-radius: 13px; overflow: hidden; flex: 0 0 auto;
  box-shadow: var(--shadow);
}
.logo-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-title { font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1.15; letter-spacing: .01em; }
.app-sub { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; margin-top: 1px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--card); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s var(--ease), background .2s; flex: 0 0 auto;
}
.icon-btn:active { transform: scale(.9); }
.icon-btn .ic { width: 20px; height: 20px; }
.icon-btn.admin-on {
  background: linear-gradient(145deg, var(--gold-3), var(--gold-2) 55%, var(--gold-1));
  border: none; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 6px 14px -6px var(--gold-2);
}

/* ============================================================ СТРАНИЦЫ */
.page { min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + 36px + var(--sab)); }
.page-in { animation: pageIn .3s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-pad { padding: 18px 16px 8px; max-width: 720px; margin: 0 auto; }

/* ============================================================ HERO */
.hero {
  position: relative; overflow: hidden;
  text-align: center; padding: 30px 20px 24px;
  border-radius: var(--r-lg); margin-bottom: 16px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--gold-3) 28%, var(--card)), var(--card) 72%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(62% 42% at 50% 0%, color-mix(in srgb, var(--gold-3) 20%, transparent), transparent 70%);
}
.hero .orn { display: flex; justify-content: center; gap: 12px; margin-bottom: 12px; }
.hero .orn i, .orn i { width: 6px; height: 6px; background: var(--gold-2); transform: rotate(45deg); border-radius: 1px; display: block; }
.hero h1 {
  font-family: var(--serif); font-size: 28px; font-weight: 700; letter-spacing: .01em;
  margin: 0 0 8px; position: relative;
  background: linear-gradient(120deg, var(--gold-1), var(--gold-2) 55%, var(--gold-1));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { color: var(--muted); margin: 0 0 18px; font-size: 13.5px; position: relative; }
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--searchbar);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 0 15px; height: 50px;
  box-shadow: var(--shadow); color: var(--muted); position: relative;
  transition: border-color .2s, box-shadow .2s;
}
.searchbar:focus-within { border-color: var(--gold-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-2) 22%, transparent), var(--shadow); }
.searchbar input { flex: 1; border: none; outline: none; background: none; font-size: 15px; color: var(--text); min-width: 0; height: 100%; }
.searchbar input::placeholder { color: var(--muted); }
.search-open { width: 100%; cursor: pointer; text-align: left; font: inherit; }
.search-open span:first-of-type { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-open .so-go { flex: 0 0 auto; font-size: 12.5px; font-weight: 700; color: var(--gold-1); background: color-mix(in srgb, var(--gold-2) 16%, transparent); padding: 6px 12px; border-radius: 999px; }
.search-open:active { transform: scale(.985); }
.search-page { padding-top: 16px; }
.searchbar.big { height: 54px; border-radius: 18px; }
.searchbar.big input { font-size: 16px; }
.sq-clear { flex: 0 0 auto; width: 32px; height: 32px; border: none; border-radius: 50%; background: var(--card-2); color: var(--muted); font-size: 14px; cursor: pointer; }
.sq-clear:active { transform: scale(.9); }
.hero-count { margin-top: 16px; font-size: 13px; color: var(--muted); position: relative; }
.hero-count b { color: var(--accent); font-size: 15px; }
.search-hint { margin-top: 4px; font-size: 11.5px; color: var(--muted); position: relative; }

/* ============================================================ СТИХ ДНЯ */
.verse {
  position: relative; overflow: hidden;
  text-align: center; padding: 24px 22px 20px; margin-bottom: 20px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(85% 65% at 50% 0%, color-mix(in srgb, var(--gold-3) 24%, transparent), transparent 70%),
    linear-gradient(165deg, color-mix(in srgb, var(--gold-3) 15%, var(--card)), var(--card) 65%);
  border: 1px solid color-mix(in srgb, var(--gold-2) 35%, var(--line));
  box-shadow: var(--shadow);
  animation: riseIn .55s var(--ease) both;
}
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.verse .v-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold-1);
  background: color-mix(in srgb, var(--gold-3) 32%, var(--card));
  border: 1px solid color-mix(in srgb, var(--gold-2) 42%, var(--line));
  padding: 6px 14px; border-radius: 999px; margin-bottom: 16px;
}
.verse .v-label .ic { width: 13px; height: 13px; }
.verse .v-text {
  font-family: var(--serif); font-size: 18px; line-height: 1.62; font-style: italic;
  color: var(--text); max-width: 520px; margin: 0 auto;
}
.verse .v-ref { margin-top: 14px; font-size: 12.5px; font-weight: 700; color: var(--accent); letter-spacing: .05em; }
.verse .v-orn { display: flex; justify-content: center; gap: 12px; margin-top: 14px; opacity: .9; }
.verse .v-orn i { width: 6px; height: 6px; background: var(--gold-2); transform: rotate(45deg); border-radius: 1px; display: block; }
.verse .v-date { font-size: 10.5px; color: var(--muted); margin-top: 6px; letter-spacing: .03em; }

/* ============================================================ СПИСКИ */
.section-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 20px 2px 12px;
}
.section-h h2 { font-family: var(--serif); font-size: 17px; font-weight: 700; margin: 0; }
.song-list { display: flex; flex-direction: column; gap: 10px; }
.song {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); color: var(--text);
  transition: transform .15s var(--ease), box-shadow .2s;
  animation: riseIn .4s var(--ease) both;
}
.song:nth-child(2) { animation-delay: .04s; }
.song:nth-child(3) { animation-delay: .08s; }
.song:nth-child(4) { animation-delay: .12s; }
.song:nth-child(5) { animation-delay: .16s; }
.song:nth-child(6) { animation-delay: .2s; }
.song:active { transform: scale(.985); }
.song-num {
  width: 42px; height: 42px; border-radius: 13px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: 15px; color: #fff;
  background: linear-gradient(145deg, var(--gold-3), var(--gold-2) 55%, var(--gold-1));
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), var(--shadow);
}
.song-title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.song-artist { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.song > .ic { color: var(--muted); width: 18px; height: 18px; }

/* ============================================================ ПЕВЦЫ */
.artist-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.artist {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 18px 8px 14px; text-align: center; box-shadow: var(--shadow); color: var(--text);
  transition: transform .15s var(--ease);
}
.artist:active { transform: scale(.96); }
.artist .ava {
  width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 22px; font-weight: 700; color: #fff;
  background: linear-gradient(145deg, var(--gold-3), var(--gold-2) 55%, var(--gold-1));
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), var(--shadow);
}
.artist .nm { font-weight: 600; font-size: 13px; line-height: 1.3; }
.artist .ct { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ============================================================ ПЕСНЯ */
.song-head { text-align: center; padding: 24px 10px 8px; }
.num-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  background: linear-gradient(145deg, var(--gold-3), var(--gold-2) 60%, var(--gold-1));
  color: #fff; font-weight: 700; font-size: 12.5px; text-shadow: 0 1px 2px rgba(0,0,0,.25);
  box-shadow: var(--shadow);
}
.song-head h1 { font-family: var(--serif); font-size: 25px; font-weight: 700; margin: 14px 0 5px; line-height: 1.25; }
.song-head .artist { color: var(--muted); font-size: 14px; }
.lyrics { max-width: 640px; margin: 16px auto 0; }
.stanza {
  font-family: var(--serif); font-size: calc(16.5px * var(--font-scale)); line-height: 1.68; white-space: pre-wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 18px; margin-bottom: 10px; box-shadow: var(--shadow);
  transition: font-size .2s var(--ease);
}
.song-actions { display: flex; gap: 10px; max-width: 640px; margin: 18px auto 0; flex-wrap: wrap; }

/* ============================================================ ИЗБРАННОЕ */
.fav-btn {
  width: 40px; height: 40px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s var(--ease), color .2s, border-color .2s; flex: 0 0 auto;
}
.fav-btn:active { transform: scale(.88); }
.fav-btn.on { color: #e0245e; border-color: color-mix(in srgb, #e0245e 40%, var(--line)); background: color-mix(in srgb, #e0245e 8%, var(--card)); }
.fav-btn.on .ic { fill: #e0245e; }
.fav-btn .ic { width: 20px; height: 20px; }
.song .fav-btn { width: 36px; height: 36px; border: none; background: none; box-shadow: none; }

/* ============================================================ РАЗМЕР ШРИФТА */
.font-ctl {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  max-width: 640px; margin: 18px auto 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 14px; box-shadow: var(--shadow);
}
.font-ctl .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.font-ctl button {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--accent); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s var(--ease);
}
.font-ctl button:active { transform: scale(.9); }
.font-ctl button .ic { width: 22px; height: 22px; }
.font-ctl .pct { min-width: 46px; text-align: center; font-weight: 700; font-size: 13px; color: var(--accent); }

/* ============================================================ КНОПКИ И ФОРМЫ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 46px; padding: 11px 18px;
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform .15s var(--ease), filter .2s; box-shadow: var(--shadow);
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(145deg, var(--gold-3), var(--gold-2) 55%, var(--gold-1));
  border: none; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 8px 20px -8px var(--gold-2);
}
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.btn.sm { min-height: 0; padding: 8px 14px; font-size: 13px; border-radius: 11px; }
.btn.block { width: 100%; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 7px; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px;
  font-size: 15px; background: var(--card); color: var(--text); outline: none; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus { border-color: var(--gold-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-2) 22%, transparent); }
.field textarea { min-height: 170px; resize: vertical; line-height: 1.55; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 11px 14px; font-size: 13px; margin-bottom: 12px; }
.form-note { font-size: 12px; color: var(--muted); text-align: center; margin: 14px 0 0; }

/* ============================================================ КАРТОЧКИ */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.empty { text-align: center; padding: 36px 22px; }
.empty .ico { color: var(--gold-2); margin-bottom: 12px; display: flex; justify-content: center; }
.empty h3 { font-family: var(--serif); margin: 0 0 6px; font-size: 17px; }
.empty p { color: var(--muted); margin: 0; font-size: 13.5px; }
.skel { border-radius: var(--r-md); background: linear-gradient(100deg, var(--card-2) 40%, var(--line-2) 50%, var(--card-2) 60%); background-size: 200% 100%; animation: skel 1.3s infinite; }
@keyframes skel { to { background-position: -200% 0; } }
.boot { min-height: 100dvh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; padding: 20px; text-align: center; }
.boot-text { color: var(--muted); font-size: 14px; }

/* ============================================================ ТОСТЫ */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 24px + var(--sab)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast {
  background: color-mix(in srgb, var(--text) 92%, transparent); color: var(--bg);
  padding: 11px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-2); animation: toastIn .25s var(--ease); max-width: 86vw; text-align: center;
}
.toast.ok { background: var(--ok); color: #fff; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================================================ НИЖНЯЯ ПАНЕЛЬ — стекло */
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--sab)); z-index: 50;
  height: var(--tabbar-h);
  display: grid; grid-template-columns: repeat(4, 1fr);
  align-items: center; padding: 6px;
  background: color-mix(in srgb, var(--tabbar) calc(var(--tabbar-opacity) * 100%), transparent);
  backdrop-filter: blur(22px) saturate(190%); -webkit-backdrop-filter: blur(22px) saturate(190%);
  border: 1px solid color-mix(in srgb, var(--gold-2) 26%, var(--line));
  border-radius: 28px;
  box-shadow: 0 12px 36px -12px rgba(60,40,5,.38), inset 0 1px 0 rgba(255,255,255,.45);
}
.tabbar.tabs-5 { grid-template-columns: repeat(5, 1fr); }
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; height: 100%; border-radius: 22px; color: var(--muted);
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
  transition: color .22s var(--ease), background .22s var(--ease);
}
.tab .ic { width: 22px; height: 22px; transition: transform .22s var(--ease); }
.tab:active .ic { transform: scale(.85); }
.tab.on {
  color: #fff;
  background: linear-gradient(145deg, var(--gold-3), var(--gold-2) 55%, var(--gold-1));
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 6px 16px -6px var(--gold-2);
}
.tab.on .ic { transform: translateY(-1px) scale(1.06); }
/* центральная кнопка + */
.tab.add { background: none; }
.tab.add.on { background: none; box-shadow: none; color: var(--accent); text-shadow: none; }
.tab.add .fab {
  width: 54px; height: 54px; margin-top: -28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(145deg, var(--gold-3), var(--gold-2) 55%, var(--gold-1));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.6), inset 0 -3px 6px rgba(0,0,0,.18), 0 10px 22px -6px var(--gold-2);
  transition: transform .2s var(--ease);
}
.tab.add .fab .ic { width: 26px; height: 26px; }
.tab.add:active .fab { transform: scale(.9); }
.tab.add span { margin-top: 3px; }

/* ============================================================ СТАТИСТИКА */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 15px; box-shadow: var(--shadow);
}
.stat-card .v { font-family: var(--serif); font-size: 24px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat-card .l { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); margin-top: 12px; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 110px; margin-top: 14px; }
.chart .bar { flex: 1; min-width: 3px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, var(--gold-3), var(--gold-2)); transition: height .4s var(--ease); }
.chart .bar.today { background: linear-gradient(180deg, var(--gold-2), var(--gold-1)); }
.chart-x { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 7px; }
.seg { display: inline-flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 7px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: linear-gradient(145deg, var(--gold-3), var(--gold-2) 60%, var(--gold-1)); color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.kv-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.kv-row:last-child { border-bottom: none; }
.kv-row b { color: var(--accent); }

/* ============================================================ ИИ-ПОИСК */
.ai-box {
  background: linear-gradient(165deg, color-mix(in srgb, var(--gold-3) 22%, var(--card)), var(--card) 75%);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.ai-box h3 { font-family: var(--serif); margin: 0 0 6px; font-size: 17px; }
.ai-box p { color: var(--muted); font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
.ai-row { display: flex; gap: 8px; }
.ai-row input {
  flex: 1; border: 1px solid var(--line); border-radius: 14px; padding: 0 15px; height: 48px;
  font-size: 15px; background: var(--card); color: var(--text); outline: none; min-width: 0;
  transition: border-color .2s, box-shadow .2s;
}
.ai-row input:focus { border-color: var(--gold-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-2) 22%, transparent); }
.ai-row .btn { height: 48px; min-height: 48px; }
.ai-loading { display: flex; align-items: center; gap: 10px; padding: 16px 2px 4px; color: var(--muted); font-size: 13.5px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold-2); animation: spin .8s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-results { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.ai-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 13px 14px; cursor: pointer; transition: transform .15s var(--ease), border-color .2s;
  box-shadow: var(--shadow);
}
.ai-item:active { transform: scale(.985); }
.ai-item .t { font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.ai-item .a { font-size: 12.5px; color: var(--accent); font-weight: 600; margin-top: 1px; }
.ai-item .s { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.ai-item .src { font-size: 10.5px; color: var(--muted); margin-top: 7px; text-transform: uppercase; letter-spacing: .05em; }
.ai-none { text-align: center; color: var(--muted); font-size: 13px; padding: 14px 0 2px; }

/* ============================================================ ИИ-ПРЕВЬЮ */
.ai-preview { margin-top: 16px; animation: pageIn .25s var(--ease); }
.ai-preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ai-preview-head .t { font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1.3; }
.ai-preview-head .a { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 1px; }
.ai-preview-head .src { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }
.ai-preview-text {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 15px 16px; max-height: 320px; overflow-y: auto;
  font-family: var(--serif); font-size: 15.5px; line-height: 1.68; white-space: pre-wrap;
  box-shadow: var(--shadow);
}
.ai-preview-actions { display: flex; gap: 8px; margin-top: 14px; }
.ai-preview-actions .btn { flex: 1; }
.ai-back {
  display: inline-flex; align-items: center; gap: 5px; border: none; background: none;
  color: var(--accent); font-size: 13px; font-weight: 700; cursor: pointer; padding: 4px 0;
}
.ai-back .ic { width: 16px; height: 16px; }
.ai-picked {
  margin-top: 16px; background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--line));
  border-radius: var(--r-md); padding: 13px 15px; font-size: 13.5px; color: var(--ok); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}

/* ============================================================ НАСТРОЙКИ */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.set-row:last-child { border-bottom: none; }
.set-row .lbl { font-size: 13.5px; font-weight: 600; }
.set-row .sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
input[type="color"] { width: 48px; height: 40px; border: 1px solid var(--line); border-radius: 12px; padding: 3px; background: var(--card); cursor: pointer; flex: 0 0 auto; }
input[type="range"] { width: 130px; accent-color: var(--gold-2); flex: 0 0 auto; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.preset {
  display: flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-size: 12.5px; font-weight: 600;
  cursor: pointer; color: var(--text);
}
.preset .dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 1px 0 rgba(255,255,255,.5), var(--shadow); }
.icon-choices { display: flex; gap: 8px; flex: 0 0 auto; }
.icon-choices button {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-choices button.on { border-color: var(--gold-2); color: var(--accent); background: color-mix(in srgb, var(--gold-2) 14%, var(--card)); }
.admin-sec { margin-top: 24px; }
.admin-sec > h2 { font-family: var(--serif); font-size: 18px; font-weight: 700; margin: 0 0 5px; display: flex; align-items: center; gap: 8px; }
.admin-sec > .desc { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }
