/* Shared by the listening page and the editor: colours, buttons, the player bar, countdown, toast, sign-in. */
:root {
  --del: #ffc9c9;
  --bg: #ffffff; --fg: #333333; --panel: #f2f2f2; --line: #dddddd; --accent: #007bff; --accent-fg: #ffffff;
  --warn: #b00020; --ok: #1b7f3b; --hl: #fff3b0; --input-bg: #ffffff; --input-line: #cccccc;
}
@media (prefers-color-scheme: dark) {
  :root {
    --del: #7a2230;
    --bg: #121212; --fg: #e0e0e0; --panel: #2a2a2a; --line: #444444; --accent: #3d8bfd; --accent-fg: #ffffff;
    --warn: #ff6b81; --ok: #5bd17f; --hl: #4a4310; --input-bg: #1e1e1e; --input-line: #555555;
  }
}
html, body, :fullscreen { background: var(--bg); color: var(--fg); }
body { font-family: Lato, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; margin: 0; padding: 0; }
.hidden { display: none !important; }
button, input, select, .box { font: inherit; color: var(--fg); }
button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
  min-height: 36px; cursor: pointer; touch-action: manipulation;
}
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.link { background: none; border: 0; min-height: 0; padding: 2px 4px; color: var(--accent); text-decoration: underline; }
/* a long press on a button must never start a text selection or open the callout menu */
button, #player-bar { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, .box:focus { outline: 3px solid #A9A9A9; outline-offset: -2px; }
input, select, .box {
  background: var(--input-bg); border: 1px solid var(--input-line); border-radius: 4px; padding: 5px 6px;
  box-sizing: border-box; min-width: 0;
}
select { padding: 8px 6px; }

/* ---- player bar ---- */
#player-bar {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 9999; background: var(--bg);
  box-shadow: 0 2px 5px rgba(0,0,0,.15); border-bottom: 1px solid var(--line);
}
/* narrow screens: one info line, then all buttons in one row (they share the width), then the seek bar */
#bar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; padding: 4px 8px 4px; }
.ctl { display: flex; align-items: stretch; gap: 6px; flex: 1 1 0; min-width: 0; }
#bar-row button { flex: 1 1 0; min-width: 0; min-height: 50px; padding: 4px 2px; font-size: 1.2em; }
#b-play { font-size: 1.35em; }
#b-play, #b-prev, #b-next { touch-action: none; }
#bar-row #b-prev, #bar-row #b-next { font-size: 1.7em; line-height: 1; }
.ico { width: 1em; height: 1em; display: block; margin: 0 auto; }   /* previous / next symbols: drawn, so the bar is as tall as the triangles */
kbd .ico { display: inline-block; vertical-align: -.15em; margin: 0; }
#nowfile {
  order: -1; flex: 0 0 100%; min-width: 0; margin: 0; font-size: .9em; line-height: 1.3; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#now-event, #now-song { display: inline; }
#now-event { font-weight: bold; opacity: .85; }
#now-event:not(:empty) + #now-song:not(:empty)::before { content: ' \2013  '; }
#seekrow { padding: 0 10px 3px; }
#seek { width: 100%; margin: 0; display: block; height: 16px; padding: 0; border: 0; border-radius: 0; background: transparent; -webkit-appearance: none; appearance: none; touch-action: none; }
#seek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line); }
#seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 0; }
#seek::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
#seek::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
#seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 0; }
#seek:disabled { opacity: .35; }
/* the playing time on the right: small note above the centred symbol (listening page) */
#bar-row #b-fs { position: relative; display: flex; align-items: center; justify-content: center; line-height: 1; }
#fs-icon { font-size: 1.7em; }
#fs-time { position: absolute; top: 3px; left: 0; right: 0; text-align: center; font-size: .55em; opacity: .7; font-variant-numeric: tabular-nums; }
#clock { font-variant-numeric: tabular-nums; }

/* wide screens: previous, -5, play | info | symbol/time, +5, next. There is no video, so the info text uses the space;
   the buttons are as tall as a video would be */
@media (min-width: 640px) {
  #bar-row { flex-wrap: nowrap; justify-content: flex-start; gap: 10px; padding: 4px 8px 2px; }
  .ctl { flex: none; align-self: stretch; }
  #bar-row button { flex: none; min-width: clamp(48px, 8vw, 80px); min-height: 0; padding: 4px 10px; font-size: 1.4em; }
  #b-play { font-size: 1.6em; }
  #nowfile {
    order: 0; display: flex; flex-direction: column; justify-content: center; flex: 1; min-width: 0; height: 90px; margin: 0; overflow: hidden;
    overflow-wrap: anywhere; white-space: normal; text-overflow: clip; line-height: 1.25; font-size: 1em;
  }
  #now-event, #now-song { display: block; }
  #now-event { font-size: .9em; }
  #now-event:not(:empty) + #now-song:not(:empty)::before { content: none; }
}
@media (min-width: 640px) and (max-height: 500px) { #nowfile { height: 72px; } }

/* countdown shown while a pair of buttons or keys is held: 3 - 2 - 1, then a check mark */
#countdown {
  position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 10001; display: none; pointer-events: none;
  min-width: 2.2em; height: 2.2em; padding: 0 .3em; box-sizing: border-box; border-radius: 1.1em;
  background: rgba(0, 0, 0, .78); color: #fff; font: bold 2em/2.2em sans-serif; text-align: center;
}
#countdown.on { display: block; }

#toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: 92vw; z-index: 10000;
  background: #222; color: #fff; padding: 8px 14px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
#toast.err { background: var(--warn); }

#login { padding: 2rem 16px; text-align: center; }
#login a.btn { display: inline-block; padding: 12px 20px; border-radius: 6px; background: var(--accent); color: var(--accent-fg); text-decoration: none; }
.muted { opacity: .7; }
