:root {
  --bg: #faf8f4; --panel: #ffffff; --text: #1f1c18; --muted: #756d62; --line: #e7e1d6;
  --accent: #8a5a12; --accent-soft: #f6ecda; --shadow: 0 12px 32px rgba(40, 30, 10, .18);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Ethiopic", "Nyala", "Abyssinica SIL", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16140f; --panel: #1e1b15; --text: #ece7dc; --muted: #a39a8a; --line: #343026;
          --accent: #e0b15a; --accent-soft: #33290f; --shadow: 0 12px 32px rgba(0, 0, 0, .6); }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body.reader { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; overflow: hidden; }
a { color: var(--accent); }

/* One column: search bar on top, lyrics scroll in the middle, player at the bottom. Only the lyrics
   (and the open results panel) scroll; the page itself never does. */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 52rem; margin: 0 auto;
       background: var(--bg); position: relative; }
.head { position: relative; z-index: 30; flex: none; padding: .55rem .6rem .35rem; background: var(--bg); }
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .28); }

.searchbox { display: flex; align-items: center; gap: .4rem; background: var(--panel); border: 1px solid var(--line);
             border-radius: 999px; padding: .25rem .4rem .25rem .3rem; }
.searchbox:focus-within { border-color: var(--accent); }
.logo { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%;
        background: var(--accent-soft); text-decoration: none; font-size: 1.15rem; }
.searchbox input { flex: 1; min-width: 4rem; border: 0; outline: 0; background: transparent; color: inherit;
                   font: inherit; font-size: 1rem; padding: .4rem .2rem; }
.chip { display: inline-flex; align-items: center; gap: .2rem; background: var(--accent-soft); border-radius: 999px;
        padding: .1rem .2rem .1rem .6rem; font-size: .85rem; white-space: nowrap; max-width: 42%; }
#chip-name { overflow: hidden; text-overflow: ellipsis; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1.2rem; line-height: 1;
               padding: .1rem .3rem; }
.toggle { flex: none; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 50%;
          width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1.05rem; }
.toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.preview { margin: .3rem .9rem 0; color: var(--accent); font-size: 1rem; }

/* results: a temporary panel under the search bar */
.panel { position: absolute; left: .6rem; right: .6rem; top: 100%; margin-top: -.1rem; z-index: 40;
         max-height: min(60vh, 30rem); max-height: min(60dvh, 30rem); overflow-y: auto; overscroll-behavior: contain;
         background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow);
         padding: .4rem; }
.singers { display: flex; flex-wrap: wrap; gap: .35rem; padding: .3rem .3rem .5rem; border-bottom: 1px solid var(--line); }
.singers button { border: 1px solid var(--line); background: var(--bg); color: inherit; border-radius: 999px;
                  padding: .25rem .7rem; cursor: pointer; font: inherit; font-size: .88rem; }
.singers button:hover, .singers button:focus-visible { border-color: var(--accent); }
.singers small { color: var(--muted); }
.status { color: var(--muted); font-size: .88rem; margin: .5rem .6rem; }
.status:empty { display: none; }
.results { list-style: none; margin: 0; padding: 0; }
.results a { display: block; padding: .6rem .7rem; border-radius: .6rem; text-decoration: none; color: inherit; }
.results li + li { border-top: 1px solid var(--line); }
.results a:hover, .results a:focus-visible, .results a.current { background: var(--accent-soft); }
.results strong { display: block; font-size: 1.02rem; }
.results .by { color: var(--muted); font-size: .82rem; display: block; }
.results .snippet { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note { font-size: .8rem; margin-left: .4rem; color: var(--accent); }
.button { border: 1px solid var(--line); background: var(--panel); color: inherit; border-radius: .6rem; padding: .35rem .65rem;
          font: inherit; font-size: .88rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.button:hover { border-color: var(--accent); }
.button.wide { width: 100%; margin-top: .4rem; }

/* lyrics buttons: directly under the search bar */
.commands { flex: none; display: flex; align-items: center; gap: .4rem; padding: .2rem .6rem .45rem;
            overflow-x: auto; scrollbar-width: none; }
.commands::-webkit-scrollbar { display: none; }
.segmented { flex: none; display: inline-flex; border: 1px solid var(--line); border-radius: .6rem; overflow: hidden;
             background: var(--panel); }
.segmented button { border: 0; background: transparent; color: inherit; padding: .35rem .6rem; font: inherit;
                    font-size: .88rem; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--panel); }
.menu-wrap { position: relative; flex: none; margin-left: auto; }
.menu { position: fixed; z-index: 50; min-width: 11rem; background: var(--panel); border: 1px solid var(--line);
        border-radius: .8rem; box-shadow: var(--shadow); padding: .3rem; display: grid; }
.menu a, .menu button { display: block; text-align: left; border: 0; background: transparent; color: inherit; font: inherit;
                        font-size: .92rem; padding: .55rem .7rem; border-radius: .5rem; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--accent-soft); }

.menu .small-only { display: none; }
@media (max-width: 400px) {                 /* very narrow phones: Print moves into the menu so everything fits */
  #print { display: none; }
  .menu .small-only { display: block; }
}

.titlebar { flex: none; padding: .1rem .9rem .5rem; border-bottom: 1px solid var(--line); }
.titlebar h1 { margin: 0; font-size: 1.2rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { margin: 0; display: flex; gap: .6rem; color: var(--muted); font-size: .85rem; min-width: 0; }
.meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer;
           text-decoration: underline; white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }

/* the only scrolling part */
.readerpane { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1rem .9rem 1.5rem;
              -webkit-overflow-scrolling: touch; }
.welcome { max-width: 28rem; margin: 12vh auto 0; text-align: center; color: var(--muted); }
.welcome .big { font-size: 2.4rem; color: var(--text); margin: 0 0 .5rem; }
.lyrics { font-size: 1.15rem; line-height: 1.8; }
.lyrics section { margin: 0 0 1.2rem; }
.lyrics p { margin: 0; }
.lyrics .latin { color: var(--muted); font-size: .92em; }
.lyrics[data-view="geez"] .latin, .lyrics[data-view="latin"] .geez { display: none; }
.lyrics[data-view="latin"] .latin { color: inherit; font-size: 1em; }
.empty { color: var(--muted); }

/* player: fixed at the bottom */
.playerbar { flex: none; padding: .5rem .8rem calc(.5rem + env(safe-area-inset-bottom)); background: var(--panel);
             border-top: 1px solid var(--line); }
.player { display: flex; align-items: center; gap: .7rem; }
.play { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 0; background: var(--accent); color: var(--panel);
        font-size: 1rem; cursor: pointer; }
.play:focus-visible, input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#seek { flex: 1; min-width: 0; accent-color: var(--accent); height: 2rem; }
.time { flex: none; font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--muted); min-width: 6.5em; text-align: right; }
.no-audio { margin: 0; padding: .4rem .2rem; color: var(--muted); font-size: .9rem; }
.youtube { margin: .2rem 0 0; font-size: .85rem; display: flex; gap: .8rem; flex-wrap: wrap; }
.youtube:empty { display: none; }

.toast { position: fixed; left: 50%; bottom: 5rem; transform: translateX(-50%); background: var(--text); color: var(--bg);
         padding: .5rem 1rem; border-radius: 999px; font-size: .9rem; z-index: 60; max-width: 90vw; }

/* on a phone, the keyboard takes the room: the player waits until it is closed */
.app.typing .playerbar { display: none; }

@media (max-width: 340px) {
  .time { min-width: 0; }
  .time .total { display: none; }
}

@media print {
  :root { --text: #000; --muted: #333; --bg: #fff; --panel: #fff; --line: #fff; }
  body.reader { overflow: visible; height: auto; }
  .app { display: block; height: auto; max-width: none; }
  .head, .commands, .playerbar, .scrim, .toast, .welcome { display: none !important; }
  .titlebar { border: 0; padding: 0 0 .5rem; }
  .titlebar h1 { white-space: normal; font-size: 1.5rem; }
  .linkish { color: #333; text-decoration: none; }
  .readerpane { overflow: visible; padding: 0; }
  .lyrics { font-size: 12pt; line-height: 1.5; }
  .lyrics section { break-inside: avoid; }
}
