@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@1,600&display=swap");

:root {
  --ink: #17221c;
  --muted: #68736c;
  --paper: #f3f1e9;
  --card: #fcfbf6;
  --line: #dcded4;
  --green: #1f5b43;
  --green-deep: #173f31;
  --mint: #d9eadb;
  --gold: #c28e39;
  --rose: #a95c4f;
  --shadow: 0 18px 60px rgba(29, 47, 37, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(223, 234, 216, .8), transparent 32rem),
    var(--paper);
  font-family: "DM Sans", system-ui, sans-serif;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
svg { width: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .025; z-index: 20; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E"); }
.topbar {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(5vw, 28px);
  border-bottom: 1px solid rgba(31, 91, 67, .12);
  background: rgba(243, 241, 233, .82);
  backdrop-filter: blur(15px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; background: var(--green); color: white; border-radius: 50% 50% 48% 52% / 48% 47% 53% 52%; transform: rotate(-3deg); }
.brand-mark svg { width: 24px; fill: currentColor; stroke: none; transform: rotate(3deg); }
.brand > span:last-child { display: flex; flex-direction: column; line-height: .92; }
.brand strong { font-size: 18px; letter-spacing: .08em; text-transform: uppercase; }
.brand em { font-family: "Playfair Display", serif; font-size: 18px; color: var(--green); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.connection-pill, .avatar-button { border: 1px solid var(--line); background: rgba(255,255,255,.55); color: var(--muted); }
.connection-pill { border-radius: 30px; padding: 9px 14px; display: flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(194, 142, 57, .12); }
.connection-pill.connected .dot { background: #53a070; box-shadow: 0 0 0 4px rgba(83,160,112,.14); }
.avatar-button { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; }
main { width: min(1180px, 90vw); margin: 0 auto 90px; }
.hero { padding: 78px 0 52px; position: relative; }
.eyebrow, .eyebrow-small, .dialog-kicker { text-transform: uppercase; letter-spacing: .18em; color: var(--green); font-weight: 700; font-size: 11px; }
.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow > span { width: 30px; height: 1px; background: var(--green); }
.hero h1 { margin: 18px 0 18px; font-size: clamp(43px, 6vw, 78px); line-height: .98; letter-spacing: -.055em; font-weight: 600; max-width: 820px; }
.hero h1 i { font-family: "Playfair Display", Georgia, serif; color: var(--green); font-weight: 600; }
.hero > p { color: var(--muted); max-width: 800px; line-height: 1.7; font-size: 16px; }
.stats { position: absolute; right: 0; bottom: 54px; display: flex; border-left: 1px solid var(--line); }
.stats div { padding: 0 22px; display: flex; flex-direction: column; }
.stats strong { font-size: 26px; letter-spacing: -.04em; }
.stats span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; white-space: nowrap; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.tab { border: 0; background: transparent; padding: 15px 18px; color: #7d857f; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; position: relative; }
.tab::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: -1px; height: 2px; background: var(--green); transform: scaleX(0); transition: transform .2s; }
.tab.active { color: var(--green); }
.tab.active::after { transform: scaleX(1); }
.view { display: none; animation: reveal .28s ease; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(7px); } }
.check-grid { display: grid; grid-template-columns: 1.6fr .8fr; gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: 5px; background: var(--card); box-shadow: var(--shadow); }
.input-panel { padding: 28px; }
.panel-heading, .section-heading, .slides-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.panel-heading > div { display: flex; align-items: center; gap: 12px; }
.step { width: 28px; height: 28px; border: 1px solid var(--green); color: var(--green); display: grid; place-items: center; border-radius: 50%; font-size: 9px; font-weight: 700; letter-spacing: .08em; }
h2, h3, p { margin-top: 0; }
.panel h2 { margin: 0; font-size: 18px; }
.helper { text-transform: uppercase; letter-spacing: .12em; color: #98a099; font-size: 9px; }
.input-panel textarea { margin-top: 24px; width: 100%; min-height: 190px; resize: vertical; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; padding: 22px 4px; outline: 0; line-height: 1.9; color: var(--ink); }
textarea::placeholder, input::placeholder { color: #a2aaa3; }
.input-footer { padding-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.input-footer > span { color: var(--muted); font-size: 11px; }
.primary-button, .secondary-button, .ghost-button, .plain-button, .text-button { border-radius: 3px; font-weight: 700; transition: .18s ease; }
.primary-button { border: 1px solid var(--green); color: white; background: var(--green); padding: 13px 18px; display: inline-flex; gap: 10px; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(31,91,67,.15); }
.primary-button:hover { background: var(--green-deep); transform: translateY(-1px); }
.primary-button.full { width: 100%; }
.primary-button svg { width: 16px; }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.guide-panel { background: var(--green-deep); color: white; padding: 30px; position: relative; overflow: hidden; }
.guide-panel::after { content: "♪"; position: absolute; font-family: Georgia, serif; font-size: 180px; color: rgba(255,255,255,.025); right: -10px; bottom: -55px; }
.guide-panel .step { border-color: rgba(255,255,255,.45); color: white; }
.guide-panel h2 { font-size: 19px; margin: 18px 0 10px; }
.guide-panel > p { color: rgba(255,255,255,.62); font-size: 12px; line-height: 1.7; }
.legend { margin-top: 25px; border-top: 1px solid rgba(255,255,255,.13); }
.legend > div { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.legend span:last-child { display: flex; flex-direction: column; font-size: 10px; color: rgba(255,255,255,.5); }
.legend strong { font-size: 12px; color: white; margin-bottom: 2px; }
.status-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.status-icon.translated { background: #dcebdc; color: var(--green); }
.status-icon.untranslated { background: #f3e6c8; color: #9b6a14; }
.status-icon.missing { background: #f0deda; color: var(--rose); }
.results-section { margin-top: 38px; }
.section-heading h2 { font-size: 28px; margin: 5px 0 0; letter-spacing: -.035em; }
.ghost-button, .secondary-button { border: 1px solid var(--line); background: rgba(255,255,255,.45); color: var(--ink); padding: 11px 15px; display: flex; align-items: center; gap: 8px; }
.ghost-button:hover, .secondary-button:hover { border-color: var(--green); color: var(--green); }
.result-list { margin-top: 18px; border-top: 1px solid var(--line); }
.result-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 17px 6px; border-bottom: 1px solid var(--line); }
.result-row .title { font-weight: 700; }
.result-row .subtitle { color: var(--muted); font-size: 11px; margin-top: 2px; }
.status-label { font-size: 10px; text-transform: uppercase; letter-spacing: .11em; font-weight: 700; white-space: nowrap; }
.status-label.translated { color: var(--green); }
.status-label.untranslated { color: #9b6a14; }
.status-label.missing { color: var(--rose); }
.row-action { border: 0; background: transparent; color: var(--green); font-size: 11px; font-weight: 700; padding: 8px; }
.catalog-heading { align-items: center; margin-bottom: 22px; }
.catalog-actions { display: flex; gap: 9px; }
.catalog-filters { display: flex; align-items: center; padding: 3px; border: 1px solid var(--line); background: rgba(255,255,255,.45); border-radius: 3px; }
.catalog-filter { border: 0; background: transparent; color: var(--muted); padding: 8px 10px; border-radius: 2px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.catalog-filter.active { background: var(--green); color: white; box-shadow: 0 4px 12px rgba(31,91,67,.13); }
.search-box { min-width: 320px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--line); background: rgba(255,255,255,.55); border-radius: 3px; }
.search-box svg { color: var(--muted); }
.search-box input { border: 0; outline: 0; background: transparent; width: 100%; padding: 11px 0; font-size: 12px; }
.catalog-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.song-card { background: var(--card); border: 1px solid var(--line); padding: 20px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; border-radius: 4px; transition: .18s; }
.song-card:hover { border-color: #b8c6bb; transform: translateY(-2px); box-shadow: var(--shadow); }
.song-card h3 { margin: 0 0 4px; font-size: 15px; }
.song-card p { margin: 0; color: var(--muted); font-size: 11px; }
.song-card-meta { margin-top: 16px; display: flex; align-items: center; gap: 8px; }
.tag { font-size: 9px; text-transform: uppercase; letter-spacing: .09em; padding: 5px 7px; border-radius: 2px; background: #ebeee9; color: var(--muted); }
.tag.translated { color: var(--green); background: var(--mint); }
.tag.removal { color: #783d35; background: #f3dfda; }
.song-card-actions { display: flex; flex-direction: column; gap: 6px; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--line); background: transparent; display: grid; place-items: center; color: var(--muted); border-radius: 50%; }
.icon-button:hover { color: var(--green); border-color: var(--green); }
.icon-button.delete-song:hover { color: #783d35; border-color: #783d35; background: #f3dfda; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-state > span { font-family: Georgia, serif; font-size: 42px; color: var(--green); }
.editor-layout { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 22px; }
.editor-main { background: var(--card); border: 1px solid var(--line); padding: 30px; box-shadow: var(--shadow); }
.draft-badge { color: var(--gold); background: #f5ead3; padding: 6px 9px; border-radius: 2px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 28px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field > span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }
.field input { width: 100%; background: transparent; border: 1px solid var(--line); border-radius: 2px; padding: 12px; outline: 0; }
.field input:focus, .slide-editor textarea:focus, .slide-editor input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,91,67,.06); }
.translation-toggle { margin-top: 18px; padding: 14px; background: #f0f4ed; display: flex; gap: 12px; align-items: center; cursor: pointer; }
.translation-toggle > input { position: absolute; opacity: 0; }
.toggle-track { width: 37px; height: 21px; border-radius: 20px; padding: 3px; background: #abb5ad; transition: .2s; flex: 0 0 auto; }
.toggle-track i { display: block; width: 15px; height: 15px; background: white; border-radius: 50%; transition: .2s; }
.translation-toggle input:checked + .toggle-track { background: var(--green); }
.translation-toggle input:checked + .toggle-track i { transform: translateX(16px); }
.translation-toggle > span:last-child { display: flex; flex-direction: column; }
.translation-toggle strong { font-size: 12px; }
.translation-toggle small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.slides-heading { margin-top: 32px; align-items: end; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.slides-heading h3 { margin: 3px 0 0; font-size: 17px; }
.slides-heading > .pair-count { color: var(--green); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.slides-heading > .pair-count.invalid { color: var(--rose); }
.text-button, .plain-button { border: 0; background: transparent; color: var(--green); padding: 7px 0; font-size: 11px; }
.lyrics-field { display: block; margin-top: 15px; }
.lyrics-field > span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; margin-bottom: 9px; }
.lyrics-field b { width: 24px; height: 18px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 2px; font-size: 8px; }
.lyrics-field i { color: var(--gold); font-style: normal; }
.lyrics-field textarea { width: 100%; min-height: 330px; border: 1px solid var(--line); outline: 0; resize: vertical; padding: 17px; background: #fffefa; font-size: 13px; line-height: 1.9; text-transform: uppercase; }
.lyrics-field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,91,67,.06); }
.lyrics-field > small { display: block; color: var(--muted); font-size: 10px; margin-top: 7px; }
.slide-editor { border: 1px solid var(--line); margin-top: 15px; background: #fdfcf8; }
.slide-top { display: flex; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #f1f1e9; }
.drag-handle { color: #a2aaa3; font-size: 8px; letter-spacing: -1px; margin-right: 9px; }
.slide-top label { flex: 1; }
.slide-top input { border: 0; background: transparent; outline: 0; width: 100%; font-size: 11px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .08em; }
.remove-slide { border: 0; background: transparent; color: #939b95; font-size: 19px; }
.combined-field { display: block; padding: 16px; }
.combined-field > span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; margin-bottom: 10px; }
.combined-field b { width: 24px; height: 18px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 2px; font-size: 8px; }
.combined-field i { color: var(--gold); font-style: normal; }
.combined-field .pair-count { margin-left: auto; color: var(--green); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.combined-field .pair-count.invalid { color: var(--rose); }
.combined-field textarea { width: 100%; min-height: 190px; border: 1px solid var(--line); outline: 0; resize: vertical; padding: 14px; background: #fffefa; font-size: 12px; line-height: 1.85; }
.language-grid { display: grid; grid-template-columns: 1fr 1fr; }
.language-grid label { padding: 14px; }
.language-grid label + label { border-left: 1px solid var(--line); }
.language-grid label > span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; margin-bottom: 9px; }
.language-grid b { width: 22px; height: 17px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 2px; font-size: 8px; }
.language-grid label + label b { background: #547266; }
.slide-editor textarea { width: 100%; min-height: 110px; border: 0; border-top: 1px solid #ecece6; outline: 0; resize: vertical; padding: 11px 2px; background: transparent; font-size: 12px; line-height: 1.7; }
.save-card, .tip-card { border: 1px solid var(--line); padding: 24px; background: var(--card); }
.save-card { position: sticky; top: 105px; }
.mini-icon { width: 32px; height: 32px; display: grid; place-items: center; background: var(--mint); color: var(--green); border-radius: 50%; margin-bottom: 16px; }
.save-card h3 { font-size: 16px; margin-bottom: 8px; }
.save-card p, .tip-card p { color: var(--muted); font-size: 11px; line-height: 1.65; }
.save-card .primary-button { margin-top: 10px; }
.plain-button { width: 100%; margin-top: 7px; color: var(--muted); }
.tip-card { margin-top: 14px; background: transparent; }
.tip-card strong { color: var(--green); font-size: 11px; }
.tip-card p { margin: 7px 0 0; }
dialog { width: min(700px, 92vw); max-height: 86vh; border: 0; border-radius: 5px; padding: 34px; color: var(--ink); background: var(--card); box-shadow: 0 30px 100px rgba(20,35,27,.28); }
dialog::backdrop { background: rgba(18,31,24,.65); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; top: 14px; right: 17px; border: 0; background: transparent; font-size: 25px; color: var(--muted); }
.dialog-title { padding-right: 35px; }
.dialog-title h2 { font-size: 26px; margin: 6px 0; }
.dialog-title p { color: var(--muted); font-size: 12px; }
#songDialog { width: min(820px, 92vw); padding: 0; overflow: hidden; }
#songDialog #songDialogContent { box-sizing: border-box; max-height: 86vh; overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; padding: 34px 48px 34px 34px; }
#songDialog .dialog-close { z-index: 3; right: 20px; width: 32px; height: 32px; border-radius: 50%; background: var(--card); line-height: 28px; }
.dialog-slide { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.dialog-slide h4 { color: var(--green); text-transform: uppercase; letter-spacing: .11em; font-size: 10px; }
.bilingual-lines { display: grid; gap: 6px; }
.bilingual-lines p { margin: 0; padding: 7px 10px; background: #f1f3ed; font-size: 12px; line-height: 1.6; }
.bilingual-lines p.translation { color: var(--green); font-style: italic; background: var(--mint); }
.interleaved-lines { display: grid; gap: 8px; }
.line-pair { min-width: 0; overflow-wrap: anywhere; border-left: 2px solid var(--green); background: #f1f3ed; padding: 8px 11px; }
.line-pair p { margin: 0; font-size: 12px; line-height: 1.55; }
.line-pair p.translation { color: var(--green); font-style: italic; margin-top: 2px; }
.settings-dialog { width: min(520px, 92vw); }
.settings-dialog > p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.settings-dialog form { display: grid; gap: 15px; margin-top: 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }
.settings-note { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; font-size: 10px; color: var(--muted); }
.settings-note strong { color: var(--green); }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 9px; }
.toast { width: min(360px, calc(100vw - 44px)); background: var(--green-deep); color: white; padding: 14px 17px; border-radius: 4px; box-shadow: 0 12px 45px rgba(0,0,0,.2); font-size: 12px; animation: toast-in .25s ease; }
.toast.error { background: #783d35; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 850px) {
  main { width: min(92vw, 680px); }
  .hero { padding-top: 55px; }
  .stats { position: static; margin-top: 35px; border-left: 0; }
  .stats div:first-child { padding-left: 0; }
  .check-grid, .editor-layout { grid-template-columns: 1fr; }
  .catalog-heading { flex-direction: column; align-items: stretch; }
  .editor-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .save-card { position: static; }
  .tip-card { margin-top: 0; }
}
@media (max-width: 620px) {
  .topbar { padding: 0 18px; height: 72px; }
  .connection-pill span:last-child { display: none; }
  .hero h1 { font-size: 42px; }
  .hero > p { font-size: 14px; }
  .stats { justify-content: space-between; }
  .stats div { padding: 0 10px; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; padding: 13px 10px; }
  .check-grid { display: block; }
  .guide-panel { margin-top: 14px; }
  .input-panel, .editor-main { padding: 20px; }
  .panel-heading .helper { display: none; }
  .input-footer { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .section-heading, .catalog-heading { flex-direction: column; align-items: stretch; }
  .catalog-actions { flex-direction: column; }
  .catalog-filters { align-self: stretch; }
  .catalog-filter { flex: 1; }
  .search-box { min-width: 0; }
  .catalog-list { grid-template-columns: 1fr; }
  .result-row { grid-template-columns: 34px minmax(0,1fr) auto; }
  .result-row .row-action { grid-column: 2 / -1; justify-self: start; padding-left: 0; }
  .form-grid, .language-grid, .editor-sidebar { grid-template-columns: 1fr; }
  .language-grid label + label { border-left: 0; border-top: 1px solid var(--line); }
  dialog { padding: 28px 20px; }
}
