/* KaraDirector WA — shared styles */
:root {
  --bg: #0e0f13;
  --bg2: #16181f;
  --panel: #1b1e27;
  --panel2: #232733;
  --line: #2f3442;
  --text: #eef0f5;
  --muted: #9aa1b2;
  --accent: #f5b84a;
  --accent-ink: #1a1306;
  --accent2: #4cc9b0;
  --danger: #ef5b5b;
  --ok: #46c46e;
  --radius: 0.75rem;
  --tap: 3rem;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* MLK-14: brand in the top-left corner of every page */
.kd-brand {
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn {
  min-height: var(--tap);
  padding: 0 1.125rem;
  border-radius: 0.625rem;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  touch-action: manipulation;
  user-select: none;
}
.btn:hover { border-color: #46506a; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.small { min-height: 2.25rem; padding: 0 0.75rem; font-size: 0.875rem; }

input[type=text], input[type=search], input[type=url], select {
  min-height: var(--tap);
  border-radius: 0.625rem;
  border: 1px solid var(--line);
  background: var(--bg2);
  padding: 0 0.875rem;
  width: 100%;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

.kd-row { display: flex; gap: 0.625rem; align-items: center; }
.kd-row.end { justify-content: flex-end; }
.muted { color: var(--muted); }
.pill {
  display: inline-block; padding: 0.125rem 0.625rem; border-radius: 62.4375rem;
  background: var(--panel2); color: var(--muted); font-size: 0.8125rem; white-space: nowrap;
}
.pill.mine { background: rgba(76, 201, 176, .15); color: var(--accent2); }
.pill.live { background: rgba(245, 184, 74, .15); color: var(--accent); }

/* toasts (MLK-06: top left, 2 s, fade) */
#kd-toasts { position: fixed; top: 0.75rem; left: 0.75rem; z-index: 1000; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; max-width: min(90vw, 28.75rem); }
.kd-toast {
  background: var(--ok); color: #06210f; font-weight: 700; padding: 0.75rem 1rem; border-radius: 0.625rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,.4); transition: opacity .6s;
}
.kd-toast.err { background: var(--danger); color: #fff; }
.kd-toast.fade { opacity: 0; }

/* modal */
.kd-modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 900; padding: 1rem; }
.kd-modal { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.25rem; width: min(32.5rem, 100%); max-height: 90vh; overflow: auto; }
.kd-modal.wide { width: min(53.75rem, 100%); }
.kd-modal h2 { margin: 0 0 0.625rem; font-size: 1.25rem; }
.kd-modal p { color: var(--muted); }

.thumb { background: #000; object-fit: cover; border-radius: 0.5rem; display: block; }

/* search panel */
.ss-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.375rem; margin-bottom: 0.625rem; }
.ss-tab { min-height: 2.75rem; border-radius: 0.625rem; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); font-weight: 700; }
.ss-tab.on { background: var(--panel2); color: var(--text); border-color: var(--accent); }
.ss-form { margin-bottom: 0.5rem; }
.ss-form .btn { white-space: nowrap; flex: none; }
.ss-status { min-height: 1.375rem; margin: 0.25rem 0.125rem 0.5rem; font-size: 0.875rem; }
.ss-results { display: grid; gap: 0.625rem; }
.ss-item { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.625rem; background: var(--panel); border-radius: var(--radius); padding: 0.5rem; border: 1px solid var(--line); }
.ss-thumb { width: 7.5rem; height: 4.25rem; cursor: pointer; }
.ss-info { min-width: 0; display: grid; align-content: start; gap: 0.25rem; }
.ss-titleline { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; align-items: start; }
.ss-title { font-weight: 600; font-size: 0.9375rem; cursor: pointer; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ss-add { min-height: 2.75rem; padding: 0 0.75rem; font-size: 0.875rem; }
.ss-added { margin-top: 0.625rem; }
.ss-meta { font-size: 0.8125rem; }


::-webkit-scrollbar { width: 0.625rem; height: 0.625rem; }
::-webkit-scrollbar-thumb { background: #333a4a; border-radius: 0.625rem; }

/* search results: already saved on this computer, or online only */
.ss-badge { font-weight: 800; font-size: 0.75rem; white-space: nowrap; }
.ss-badge-local { color: #46c46e; }
.ss-badge-online { color: var(--muted); font-weight: 700; }

/* singer picker: centred 2-line name, used on the master page only */
.singer-shown { display: none; }
/* 2.10.57: touch screens: popups at the top, inside the space above the on-screen keyboard */
.kd-modal-wrap.kd-top { place-items: start center; padding: 0.5rem 0.625rem; top: var(--vvtop, 0px); bottom: auto; height: var(--vvh, 100%); box-sizing: border-box; }
.kd-modal-wrap.kd-top .kd-modal { max-height: calc(var(--vvh, 100vh) - 1rem) !important; overflow: auto; }
/* 2.10.57: "Who's singing?" (asked for every song): big name buttons, nothing pre-selected */
.ws-modal { width: min(38.75rem, 100%); }
.ws-pop h2 { margin: 0 0 0.25rem; }
.ws-song { margin: 0 0 0.625rem; font-weight: 700; color: var(--accent, #f5b84a); overflow-wrap: anywhere; }
.ws-hint { margin: -0.25rem 0 0.5rem; font-weight: 700; }
.ws-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.375rem, 1fr)); gap: 0.625rem; max-height: 46vh; overflow: auto; padding: 0.125rem; }
.ws-name { min-height: 3.5rem; padding: 0.5rem 0.625rem; border-radius: 0.75rem; border: 0.125rem solid var(--line); background: var(--bg2, #1a1d25); color: var(--text);
  font: 700 1.125rem/1.15 inherit; cursor: pointer; overflow-wrap: anywhere; }
.ws-name:hover { border-color: var(--accent, #f5b84a); }
.ws-name.on { border-color: #46c46e; background: rgba(70,196,110,.18); color: #7dffa6; }
.ws-new { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.ws-new[hidden] { display: none; }
.ws-new input { flex: 1 1 auto; min-width: 0; font-size: 1.125rem; }
.ws-tools { margin-top: 0.875rem; gap: 0.5rem; flex-wrap: wrap; }
.ws-tools .ws-gap { flex: 1 1 auto; }
.ws-tools .ws-duet.on { border-color: #46c46e; color: #46c46e; }
.kd-toast-act { display: flex; align-items: center; gap: 0.625rem; pointer-events: auto; }
.kd-toast-act .btn { pointer-events: auto; white-space: nowrap; }

/* === 2.10.60 === */
/* Who's singing? name buttons are 120 x 50; long names wrap to two lines in smaller text (full name on hover) */
.ws-names { grid-template-columns: repeat(auto-fill, 7.5rem) !important; justify-content: center; }
.ws-name { width: 7.5rem; height: 3.125rem; min-height: 0 !important; padding: 0.125rem 0.375rem !important; display: flex; align-items: center; justify-content: center;
  font-size: 1.0625rem !important; line-height: 1.1 !important; overflow: hidden; }
.ws-name > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; text-align: center; }
.ws-name.ws-l { font-size: 0.875rem !important; }
.ws-name.ws-xl { font-size: 0.75rem !important; }
/* 2.10.61: YouTube + Local: our own songs first, marked "✓ On our list" (master, tablets and guests) */
.ss-ours { color: #46c46e; font-weight: 800; }
/* 2.10.63: not registered: other screens show a plain notice */
.kd-reg-lock { position: fixed; inset: 0; z-index: 9999; background: rgba(8,9,12,.97); display: grid; place-items: center; padding: 1.5rem; }
.kd-reg-lock-card { text-align: center; max-width: 32.5rem; color: #e9ecf2; }
.kd-reg-lock-card h1 { font-size: 1.625rem; margin: 0.625rem 0; }
.kd-reg-lock-icon { font-size: 3.375rem; }
/* 2.10.65: Hi-Res Audio (FLAC / WAV) on the playing song */
.hires-tag { font-size: 1rem !important; font-weight: 800; color: #f5c542 !important; text-shadow: 0 0 0.375rem rgba(245,197,66,.45); white-space: nowrap; flex: none; margin-left: 0.5rem; }

/* 2.10.71: QR code button for guests (icon = the real QR code) and its big view */
.qr-share { flex: none; display: inline-grid; place-items: center; padding: 0.1875rem; aspect-ratio: 1; height: 100%; min-height: 2.75rem; border-radius: 0.625rem; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.qr-share img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.st-qr { width: 4.75rem; height: auto; align-self: stretch; }
.qr-modal { text-align: center; }
.qr-big h2 { margin: 0 0 0.75rem; font-size: 1.25rem; }
.qr-big img { width: min(78vw, 22.5rem); height: auto; aspect-ratio: 1; background: #fff; border-radius: 0.75rem; padding: 0.5rem; box-sizing: border-box; }
.qr-big-url { margin: 0.625rem 0 0.25rem; font-size: 0.9375rem; color: var(--muted); overflow-wrap: anywhere; }
.qr-big-close { margin-top: 0.75rem; min-width: 10rem; min-height: 3rem; font-size: 1.125rem; }

/* === 2.10.73: search boxes (laptop, tablets, guest phones) === */
/* the old results stay (dimmed) while a new search runs, with the status line on top */
.ss.ss-busy .ss-results { opacity: .45; transition: opacity .2s; pointer-events: none; }
.ss.ss-busy .ss-status { display: flex !important; align-items: center; gap: 0.5rem; color: var(--accent, #f5b84a); font-weight: 700; }
.ss.ss-busy .ss-status::before { content: ''; width: 0.875rem; height: 0.875rem; border-radius: 50%; border: 0.125rem solid currentColor; border-right-color: transparent; animation: kdSpin .8s linear infinite; flex: none; }
@keyframes kdSpin { to { transform: rotate(360deg); } }
/* 20 px text in capitals; a big ✕ (clear) the full height of the box */
input.ss-q { font-size: 1.25rem !important; text-transform: uppercase; }
input.ss-q::placeholder { text-transform: uppercase; }
input.ss-q::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; height: 100%; min-height: 2rem; width: 2.75rem; margin: 0 -0.375rem 0 0.25rem; cursor: pointer; opacity: .85;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' stroke='%23eef0f5' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / 1.25rem 1.25rem no-repeat; }
input.ss-q::-webkit-search-cancel-button:hover { opacity: 1; }
/* 2.10.74: the search box's own ✕: the full height of the box, shown when there's text */
.ss-qwrap { position: relative; display: flex; align-items: stretch; flex: 1 1 auto; min-width: 0; }
.ss-qwrap input.ss-q { flex: 1 1 auto; min-width: 0; width: 100%; padding-right: 3.125rem !important; }
input.ss-q::-webkit-search-cancel-button { display: none !important; }
.ss-clear { position: absolute; top: 0; right: 0; bottom: 0; width: 2.875rem; min-height: 0 !important; height: auto !important; padding: 0 !important; display: none; align-items: center; justify-content: center;
  border: 0 !important; border-left: 1px solid var(--line) !important; border-radius: 0 0.625rem 0.625rem 0 !important; background: rgba(255,255,255,.06) !important; color: var(--text) !important;
  font-size: 1.375rem !important; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: none !important; }
.ss-qwrap.has-text .ss-clear { display: flex; }
.ss-clear:hover, .ss-clear:active { background: rgba(255,255,255,.16) !important; }
/* 2.10.77: Smart Search: what the codes became, with "Search as typed" */
.ss-codes { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem 0.5rem; margin: 0.25rem 0 0.375rem; font-size: 0.8125rem; color: var(--text); }
.ss-codes[hidden] { display: none; }
.ss-codes b { text-transform: uppercase; color: var(--accent, #f5b84a); }
.ss-codes .ss-astyped { min-height: 1.875rem; padding: 0 0.75rem; font-size: 0.8125rem; }
/* 2.10.79: Add to queue in the bottom-right corner of each search result (laptop, tablets, guest phones) */
.ss .ss-item .ss-info { display: flex !important; flex-direction: column; align-self: stretch !important; min-width: 0; }
.ss .ss-item .ss-titleline { display: contents !important; }
.ss .ss-item .ss-title { order: 1; }
.ss .ss-item .ss-meta { order: 2; }
.ss .ss-item .ss-add, .ss .ss-item .ss-added { order: 3; align-self: flex-end !important; justify-self: end !important; margin-top: auto !important; margin-left: auto; }

/* 2.10.81: the search text is white in every theme (themes with a light search box get a dark one) */
html[data-theme] .ss-box.ss-box input.ss-q, html[data-theme] input.ss-q.ss-q { color: #fff !important; -webkit-text-fill-color: #fff !important; caret-color: #fff; }
html[data-theme] .ss-box.ss-box input.ss-q::placeholder { color: rgba(255,255,255,.55) !important; -webkit-text-fill-color: rgba(255,255,255,.55) !important; }
html[data-theme="icy"] .ss-box.ss-box { background: #0e2236 !important; border-color: #bfe3ff !important; }
html[data-theme="summer"] .ss-box.ss-box { background: #12362c !important; }
html[data-theme="tropical"] .ss-box.ss-box { background: #4a2a12 !important; }

.ws-pop .ws-err { color: #ff6b6b; font-size: 0.9375rem; font-weight: 700; margin: 0 0 0.5rem; }
/* 2.18.6: boxed number before a search result's title (shown on the host page only) */
.ss-qn { display: none; }
