/* Guest (phone) page — implements the "Event Jukebox" design:
   dark plum surfaces, gold = now-playing/you, red-orange = actions,
   Noto Serif TC for display headings, Noto Sans TC for everything else. */

:root {
  --bg-a: oklch(17% 0.03 325);
  --bg-b: oklch(13% 0.026 325);
  --card: oklch(22% 0.035 325);
  --thumb: oklch(28% 0.03 325);
  --line: oklch(100% 0 0 / 0.09);
  --line-soft: oklch(100% 0 0 / 0.08);
  --fill: oklch(100% 0 0 / 0.06);
  --fill-hover: oklch(100% 0 0 / 0.1);
  --gold: oklch(80% 0.14 85);
  --gold-ink: oklch(20% 0.04 85);
  --red: oklch(68% 0.18 32);
  --red-hover: oklch(60% 0.19 28);
  --red-ink: oklch(98% 0.01 40);
  --text-hi: oklch(97% 0.012 85);
  --text: oklch(94% 0.012 85);
  --warm: oklch(72% 0.03 55);
  --warm-soft: oklch(78% 0.02 60);
  --muted: oklch(56% 0.025 320);
  --faint: oklch(48% 0.02 320);
  --ok-bg: oklch(26% 0.045 150);
  --ok-border: oklch(70% 0.14 150 / 0.4);
  --ok-icon: oklch(70% 0.14 150);
  --ok-ink: oklch(20% 0.05 150);
  --ok-text: oklch(96% 0.02 150);
  --ok-sub: oklch(80% 0.05 150);
  --serif: "Noto Serif TC", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }

@keyframes eqBounce {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

body {
  background: linear-gradient(180deg, var(--bg-a) 0%, var(--bg-b) 100%) fixed;
  color: var(--text);
  font-family: var(--sans);
  max-width: 600px;
  margin: 0 auto;
  padding: 2.2rem 1.4rem 4rem;
  min-height: 100vh;
}

/* ---- Header ---- */
header h1 { font: 700 34px/1.25 var(--serif); color: var(--text-hi); }
header .h-sub { font: 600 15px/1.3 var(--sans); color: var(--warm); margin-top: 2px; }
header p { font: 400 13.5px/1.6 var(--sans); color: var(--muted); margin-top: 10px; }

/* ---- Name field ---- */
.name-wrap {
  margin-top: 22px;
  height: 50px;
  border-radius: 14px;
  background: var(--fill);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  color: oklch(55% 0.025 320);
}
.name-wrap:focus-within { border-color: oklch(100% 0 0 / 0.22); }
.name-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font: 500 15px/1 var(--sans);
  color: oklch(90% 0.01 85);
  outline: none;
}
.name-wrap input::placeholder { color: var(--faint); font-weight: 400; }
.name-hint { font: 400 11.5px/1.3 var(--sans); color: var(--faint); margin-top: 6px; }

/* ---- Search ---- */
#search-form { margin-top: 18px; display: flex; gap: 10px; }
#q {
  flex: 1;
  min-width: 0;
  height: 50px;
  border-radius: 14px;
  background: var(--fill);
  border: 1px solid var(--line);
  padding: 0 16px;
  font: 400 14.5px/1 var(--sans);
  color: var(--text);
}
#q::placeholder { color: var(--faint); }
#q:focus { outline: none; border-color: oklch(100% 0 0 / 0.22); }
#search-btn {
  width: 64px;
  height: 50px;
  border-radius: 14px;
  background: var(--red);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--red-ink);
  cursor: pointer;
}
#search-btn:active { background: var(--red-hover); }

/* ---- Explore (點唱台) ---- */
#suggestions-section { margin-top: 34px; }
.sug-head { display: flex; align-items: center; margin-bottom: 18px; }
.sec-title { font: 700 20px/1 var(--sans); color: var(--text-hi); }
.sec-title small {
  font: 500 12px/1 var(--sans);
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 4px;
}
.shuffle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--fill);
  border: 1px solid var(--line);
  color: var(--warm-soft);
  font: 600 13px/1 var(--sans);
  cursor: pointer;
}
.shuffle:active { background: var(--fill-hover); }

/* Singer row — gradient avatar circles, gold ring when active */
.singers {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.singers::-webkit-scrollbar { display: none; }
.singer-chip {
  flex-shrink: 0;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 3px;
}
.singer-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(155deg, oklch(72% 0.15 45), oklch(60% 0.19 25));
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 20px/1 var(--sans);
  color: var(--red-ink);
}
.singer-chip.active .singer-avatar { box-shadow: 0 0 0 3px var(--gold); }
.singer-name { font: 500 12.5px/1 var(--sans); color: var(--warm); max-width: 64px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.singer-chip.active .singer-name { color: var(--text); font-weight: 600; }

/* Genre chips — icon + label pills, gold when active */
.genre-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.genre-tabs::-webkit-scrollbar { display: none; }
.genre-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--fill);
  border: 1px solid oklch(100% 0 0 / 0.1);
  color: var(--warm);
  font: 600 13.5px/1 var(--sans);
  white-space: nowrap;
  flex-shrink: 0;
}
.genre-tab.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--gold-ink);
  font-weight: 700;
}

/* ---- Results ---- */
.status { text-align: center; color: var(--muted); padding: 1rem; font: 400 13.5px/1.5 var(--sans); }

.back-to-explore {
  display: block;
  width: 100%;
  margin: 16px 0 0;
  height: 46px;
  border-radius: 14px;
  background: var(--fill);
  border: 1px solid var(--line-soft);
  color: var(--warm-soft);
  font: 600 14px/1 var(--sans);
}

#results, #queue { list-style: none; }
#results { margin-top: 20px; }
#results li { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
#results img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  background: var(--thumb);
}
.r-meta { flex: 1; min-width: 0; }
.r-title {
  font: 600 15px/1.35 var(--sans);
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.r-sub { font: 400 12.5px/1.3 var(--sans); color: var(--muted); margin-top: 4px; }
.add-btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 34px;
  height: 34px;
  min-height:34px;
  border-radius: 8px;
  border: 1px solid #b97931;
  background: #3a291b;
  color: #ffb463;
  font: 700 23px/1 var(--sans);
  flex-shrink: 0;
  cursor: pointer;
  touch-action:manipulation;
}
.add-btn:hover,
.add-btn:focus-visible { background:#6b451d; border-color:#ffb463; outline-offset:2px; }
.add-btn:active { background: #6b451d; }
.add-btn:disabled {
  opacity:.72;
  cursor:wait;
  background: var(--fill);
  border: 1px solid oklch(100% 0 0 / 0.1);
  color: oklch(60% 0.02 320);
  font-size: 18px;
}

.more {
  margin: 16px 0 0;
  width: 100%;
  height: 46px;
  border-radius: 14px;
  background: oklch(100% 0 0 / 0.05);
  border: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--warm-soft);
  font: 600 14px/1 var(--sans);
}
.more:disabled { opacity: 0.5; }
.more.hidden { display: none; }

/* ---- Up Next (接下來) ---- */
.queue-section { margin-top: 38px; }
.queue-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font: 700 20px/1 var(--sans);
  color: var(--text-hi);
}
.queue-section h2 small {
  font: 500 12px/1 var(--sans);
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.count {
  margin-left: auto;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 12px;
  background: var(--red);
  color: var(--red-ink);
  font: 700 12px/24px var(--sans);
  text-align: center;
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: oklch(28% 0.045 85 / 0.18);
  border: 1px solid oklch(80% 0.14 85 / 0.35);
  margin-top: 20px;
}
.now-playing img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--thumb);
}
.np-body { flex: 1; min-width: 0; }
.np-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 700 10.5px/1 var(--sans);
  color: var(--gold);
  letter-spacing: 0.06em;
}
.np-title { font: 600 15px/1.3 var(--sans); color: oklch(95% 0.012 85); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { font: 400 12px/1.3 var(--sans); color: oklch(60% 0.025 320); }

.eq { display: flex; align-items: flex-end; gap: 1.5px; height: 9px; }
.eq span { width: 2.2px; background: var(--gold); border-radius: 1px; display: inline-block; }
.eq span:nth-child(1) { height: 60%; animation: eqBounce 0.9s ease-in-out infinite; }
.eq span:nth-child(2) { height: 100%; animation: eqBounce 1.1s ease-in-out infinite 0.15s; }
.eq span:nth-child(3) { height: 45%; animation: eqBounce 0.8s ease-in-out infinite 0.3s; }

#queue li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; }
.q-num { width: 18px; text-align: center; font: 600 13px/1 var(--sans); color: oklch(50% 0.02 320); flex-shrink: 0; }
#queue img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--thumb); }
.q-text { min-width: 0; flex: 1; }
.q-text .t-row { display: flex; align-items: center; gap: 7px; }
.q-text .t { font: 600 15px/1.3 var(--sans); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-text .s { font: 400 12px/1.3 var(--sans); color: var(--muted); }
.q-you {
  flex-shrink: 0;
  background: var(--gold);
  color: var(--gold-ink);
  font: 700 10px/1 var(--sans);
  border-radius: 999px;
  padding: 2.5px 7px;
}
.q-empty { color: var(--muted); padding: 0.6rem 0; font: 400 13.5px/1.5 var(--sans); }

/* ---- Toasts ---- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  width: min(90%, 400px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
  pointer-events: none; /* feedback only — never blocks taps on content below */
}
.toast {
  position: relative;
  overflow: hidden; /* clips the checking scan bar to the rounded corners */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(2rem);
  transition: all 0.25s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast-ico {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--fill);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}
.toast > div { min-width: 0; } /* lets the subline ellipsis inside the flex row */
.toast-main { font: 700 14.5px/1.3 var(--sans); color: var(--text-hi); }
.toast-sub {
  font: 400 12px/1.3 var(--sans);
  color: var(--muted);
  margin-top: 1px;
  /* long YouTube titles stay one line */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.ok { background: var(--ok-bg); border-color: var(--ok-border); }
.toast.ok .toast-ico { background: var(--ok-icon); color: var(--ok-ink); }
.toast.ok .toast-main { color: var(--ok-text); }
.toast.ok .toast-sub { color: var(--ok-sub); }
.toast.bad { border-color: oklch(68% 0.18 32 / 0.5); }
.toast.bad .toast-ico { background: oklch(68% 0.18 32 / 0.2); }
.toast.info { border-color: oklch(80% 0.14 85 / 0.4); }
.toast.info .toast-ico { background: oklch(80% 0.14 85 / 0.15); }

/* While the filter checks a song (can take 5–20s with web search): sweep a
   light along the bottom edge and pulse the icon so the wait reads as live
   activity, not a frozen card. */
.toast.checking::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 40%;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, oklch(80% 0.14 85), transparent);
  animation: toast-scan 1.4s ease-in-out infinite;
}
@keyframes toast-scan {
  from { transform: translateX(-100%); } /* own width off-screen left */
  to { transform: translateX(250%); }    /* 250% of 40% = clear of the right edge */
}
.toast.checking .toast-ico { animation: toast-pulse 1.4s ease-in-out infinite; }
@keyframes toast-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.10); }
}

/* V1.0.6: overflow-only one-way song text. Keep original queue markup and click behavior. */
#now-playing .np-title,#now-playing .np-sub,#queue .q-text .t,#queue .q-text .s {
  display:block; width:max-content; max-width:none; overflow:visible;
  text-overflow:clip; white-space:nowrap; will-change:transform;
}
#now-playing .np-body,#queue .q-text,#queue .q-text .t-row {
  min-width:0; overflow:hidden;
}
@media(prefers-reduced-motion:reduce){
  #now-playing .np-title,#now-playing .np-sub,#queue .q-text .t,#queue .q-text .s {animation:none!important;transform:none!important}
}

/* V1.0.7: independent clipping for title and artist so both travel at 40px/s
   and the requester badge stays visible. Leave the row DOM untouched on state refresh. */
#now-playing .np-title-clip, #now-playing .np-sub-clip,
#queue .q-text .t-clip, #queue .q-text .s-clip {
  display:block; position:relative; min-width:0; width:100%; overflow:hidden;
  white-space:nowrap;
}
#queue .q-text .t-row {display:flex; align-items:center; min-width:0;}
#queue .q-text .t-clip {flex:1 1 0; width:auto;}
#queue .q-text .q-you {flex:0 0 auto;}
#now-playing .np-title, #now-playing .np-sub,
#queue .q-text .t, #queue .q-text .s {
  display:inline-block; width:max-content; min-width:max-content;
  max-width:none; overflow:visible; white-space:nowrap;
  text-overflow:clip; transform:translateX(0);
}

/* Fixed-height six-row scroll viewport; category datasets can now preload 20. */
#results { max-height: 460px; overflow-y: scroll; overscroll-behavior-y: contain;
  scrollbar-width: auto; scrollbar-color: #f4a340 #302a23; scrollbar-gutter: stable;
  padding-right: 8px; }
#results li { height: 80px; box-sizing: border-box; }
#results::-webkit-scrollbar { width: 14px; }
#results::-webkit-scrollbar-track { background: #302a23; border-radius: 8px; }
#results::-webkit-scrollbar-thumb { background: #f4a340; border: 3px solid #302a23; border-radius: 8px; min-height: 36px; }
.ranking-section { margin: 26px 0; border: 1px solid #51402b; border-radius: 14px; padding: 16px; background: #1d1914; }
.ranking-section h2 { font-size: 19px; margin: 0 0 14px; }
.ranking-tabs { display:flex; gap:8px; margin-bottom:12px; }
.ranking-tabs button { padding:9px 16px; border:1px solid #685033; border-radius:18px; background:transparent; color:#d9cbb6; cursor:pointer; }
.ranking-tabs button.active { background:#f4a340; color:#19130c; font-weight:700; }
#ranking-list { list-style:none; margin:0; padding:0; max-height:300px; overflow:auto; }
#ranking-list li { display:flex; align-items:center; gap:12px; min-height:48px; border-bottom:1px solid #352c22; font-size:14px; }
.rank-number { width:24px; flex-shrink:0; font-weight:800; color:#f4a340; }
.rank-clip { flex:1; min-width:0; overflow:hidden; white-space:nowrap; }
.rank-song { display:inline-block; width:max-content; max-width:none; white-space:nowrap; vertical-align:middle; }
.rank-count { flex-shrink:0; color:#f4a340; font-variant-numeric:tabular-nums; font-size:13px; }

/* Seven empty booking rows are reserved after the final real booking. */
#queue li[data-request-id] { min-height:60px; }
#queue-bottom-space { height:140px; flex:none; pointer-events:none; }
/* Keep the six-row viewport steady while scrolling through twenty preloaded entries. */
#results { height:480px; max-height:480px; overflow-anchor:none; }
#ranking-list { scrollbar-gutter:stable; padding-right:8px; }
.rank-song { min-width:0; }
.rank-count { min-width:62px; text-align:right; padding-right:3px; }
/* Keep an actual scroll endpoint when the first six rows exactly fill the viewport. */
#results:not(:empty)::after { content:""; display:block; height:1px; }

/* V1.0.8.2: stable pending count width */
.count { min-width:4.8em; width:auto; flex-shrink:0; white-space:nowrap; font-variant-numeric:tabular-nums; padding:3px 7px; border-radius:12px; }
.np-label,.now-label {display:flex; align-items:center; gap:6px;}
.np-count,#now-count {margin-left:auto;margin-right:12px;}
button {touch-action:manipulation;}

#queue-jump {position:fixed;right:14px;bottom:18px;z-index:90;border:1px solid #dc8335;border-radius:24px;padding:10px 14px;background:#201c19;color:#ffad65;font-size:18px;}
.ranking-section summary {cursor:pointer;font-size:18px;font-weight:700;padding:10px 0;}
.rank-count {flex-shrink:0;min-width:6em;text-align:right;}
.q-cancel {flex-shrink:0;min-width:40px;min-height:40px;border-radius:8px;border:1px solid #666;background:transparent;color:inherit;font-size:24px;}

.toast.ok.show {animation:booking-success 280ms ease-out;transform-origin:bottom center;}
@keyframes booking-success {0% {transform:scale(1);} 50% {transform:scale(1.10);} 100% {transform:scale(1);}}
.toast-sub {font-size:14px;line-height:1.4;}


/* V1.0.8.6: ranking row: number | long-name left marquee | request + | compact fixed count.
   The name is the ONLY shrinking column; '+', request total and scrollbar never clip. */
#ranking-list {
  width:100%; min-width:0; max-height:300px;
  padding-right:4px; scrollbar-gutter:stable;
  scrollbar-width:thin; scrollbar-color:#806b50 #1d1914;
}
#ranking-list::-webkit-scrollbar { width:8px; }
#ranking-list::-webkit-scrollbar-track { background:#1d1914; border-radius:6px; }
#ranking-list::-webkit-scrollbar-thumb {
  background:#806b50; border:2px solid #1d1914; border-radius:8px;
}
#ranking-list::-webkit-scrollbar-thumb:hover { background:#b6925c; }
#ranking-list li {
  display:flex; width:100%; min-width:0; gap:5px;
  overflow:hidden; padding-right:2px;
}
#ranking-list .rank-number { width:22px; flex:0 0 22px; text-align:left; }
#ranking-list .rank-clip {
  flex:1 1 0; width:0; min-width:0; overflow:hidden; white-space:nowrap;
}
#ranking-list .rank-song {
  display:inline-block; width:max-content; max-width:none;
  white-space:nowrap; will-change:transform;
}
#ranking-list .rank-add-btn {
  display:inline-flex; align-items:center; justify-content:center;
  flex:0 0 34px; width:34px; height:34px; min-height:34px;
  padding:0; margin:0 1px; border-radius:8px;
  border:1px solid #b97931; background:#3a291b;
  color:#ffb463; font:700 23px/1 var(--sans); cursor:pointer;
  touch-action:manipulation;
}
#ranking-list .rank-add-btn:hover,
#ranking-list .rank-add-btn:focus-visible {
  background:#6b451d; border-color:#ffb463; outline-offset:2px;
}
#ranking-list .rank-add-btn:disabled { opacity:.72; cursor:wait; }
#ranking-list .rank-count {
  flex:0 0 var(--rank-count-width, 7ch);
  width:var(--rank-count-width, 7ch); min-width:0; max-width:none;
  padding:0 2px 0 1px; margin:0;
  text-align:left; white-space:nowrap; overflow:visible;
  font-size:clamp(11px,2.7vw,13px); font-variant-numeric:tabular-nums;
}
@media (max-width:370px) {
  #ranking-list li { gap:3px; }
  #ranking-list .rank-number {width:18px;flex-basis:18px;}
  #ranking-list .rank-add-btn {width:32px;flex-basis:32px;height:34px;}
  #ranking-list .rank-count {font-size:11px;}
}


/* V1.0.8.7: precise annotated ranking columns (red title / green + / yellow
   numeric requests). Only the title region is permitted to animate. */
.ranking-section {--rank-count-width:43px;--rank-scrollbar-space:0px;}
.ranking-section .ranking-tabs {align-items:center;min-width:0;gap:6px;}
.ranking-section .ranking-tabs [data-rank-period] {flex:0 1 auto;min-width:0;white-space:nowrap;padding:9px clamp(7px,2vw,16px);}
.ranking-section .rank-count-heading {
  flex:0 0 var(--rank-count-width);width:var(--rank-count-width);min-width:0;
  margin-left:auto;margin-right:calc(var(--rank-scrollbar-space) + 6px);
  color:#f4a340;font-size:13px;font-weight:700;text-align:left;white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
#ranking-list li {gap:4px!important;}
#ranking-list .rank-clip {
  position:relative;display:block;flex:1 1 0;width:0;min-width:0;
  padding:0;margin:0 2px 0 0;overflow:hidden!important;white-space:nowrap;
  contain:paint;isolation:isolate; /* never bleed into the green + column */
}
#ranking-list .rank-song {
  display:inline-block;width:max-content;max-width:none;white-space:nowrap;
  transform:translateX(0);will-change:transform;
}
#ranking-list .rank-add-btn {margin:0 1px;position:relative;z-index:1;}
#ranking-list .rank-count {
  padding:0 1px 0 0!important;margin:0!important;text-align:left!important;
  font-variant-numeric:tabular-nums;white-space:nowrap;overflow:visible;
  flex:0 0 var(--rank-count-width);width:var(--rank-count-width);
}
@media (max-width:370px) {
 .ranking-section .rank-count-heading {font-size:11px;}
 .ranking-section .ranking-tabs [data-rank-period] {font-size:12px;padding:8px 6px;}
}

.ranking-section .ranking-tabs [data-rank-period] {overflow:hidden;text-overflow:ellipsis;}

/* V1.0.8.9: match the popularity header font to both period tabs.
   Keep label above the numeric column, not repeated in every song row. */
.ranking-section .ranking-tabs [data-rank-period],
.ranking-section .rank-count-heading {
  font-size:clamp(12px, 2.7vw, 14px)!important;
  line-height:1.2!important;
}
/* Compact feedback does not obscure the bottom ranking and queue controls. */
.toasts {
  top:calc(env(safe-area-inset-top, 0px) + 12px);
  bottom:auto;
  width:min(90vw, 340px);
  z-index:80;
}
.toast {padding:9px 11px;gap:8px;border-radius:11px;box-shadow:0 6px 16px rgba(0,0,0,.3);}
.toast-ico {width:25px;height:25px;font-size:13px;}
.toast-main {font-size:13px;line-height:1.35;}
.toast-sub {font-size:11px;line-height:1.25;}

/* V1.0.8.13: hidden moderation, only active after server PIN verification. */
#guest-moderation-trigger {display:inline-block;position:relative;cursor:default;user-select:none;-webkit-user-select:none;touch-action:manipulation;}
/* Enlarged invisible hit target without visibly changing the tiny ° logo. */
#guest-moderation-trigger::after {content:"";position:absolute;top:50%;left:50%;width:26px;height:32px;transform:translate(-50%,-50%);background:transparent;}
body.guest-blacklist-mode {filter:grayscale(1)!important;}
#guest-blacklist-banner {display:none;}
body.guest-blacklist-mode #guest-blacklist-banner {
  display:block;position:sticky;top:0;z-index:120;
  margin:-8px 0 16px;padding:12px 14px;border:2px solid #ccc;
  background:#222;color:#fff;font:700 14px/1.4 var(--sans);
  text-align:center;border-radius:10px;box-shadow:0 5px 25px #0008;
}
/* Ordinary guest sees only the unchanged orange booking +. */
.white-add-btn { display:none!important; }
/* Hidden management mode: the former booking + becomes black/white blacklist.
   The NEW white + is a distinct button with the exact inverse palette. */
body.guest-blacklist-mode .add-btn,
body.guest-blacklist-mode .rank-add-btn {
  border:1px solid #fff!important;background:#080808!important;color:#fff!important;
}
body.guest-blacklist-mode .add-btn:focus-visible {outline:2px solid #fff;}
body.guest-blacklist-mode .white-add-btn {
  display:grid!important;place-items:center!important;
  flex:0 0 34px!important;width:34px;height:34px;min-width:34px;
  border-radius:8px;border:1px solid #080808!important;
  background:#fff!important;color:#080808!important;
  font:700 23px/1 var(--sans);padding:0;margin:0;
  text-align:center;cursor:pointer;touch-action:manipulation;
}
body.guest-blacklist-mode .white-add-btn:disabled {opacity:.68;cursor:wait;}
body.guest-blacklist-mode .rank-white-add-btn {flex-basis:34px!important;}
@media(max-width:370px){body.guest-blacklist-mode .rank-white-add-btn {width:32px!important;min-width:32px!important;flex-basis:32px!important;height:34px;}}
body.guest-blacklist-mode .white-add-btn:focus-visible {outline:2px solid #080808;outline-offset:2px;}

/* V1.0.8.16: preserve all category-list dimensions, colors and buttons.
   When its internal scrollbar reaches an edge, allow the gesture to continue
   scrolling the WHOLE guest page towards the ranking and booking section. */
#results { overscroll-behavior-y:auto!important; }

/* V1.0.8.24: document-level blank after queue is about one third of V1.0.8.23.
   Other guest sections and category scroller retain their existing dimensions. */
#queue-bottom-space { height:max(140px, 33.333dvh); min-height:140px; pointer-events:none; }

/* V1.0.8.18: search/category title clips independently from the '+' action.
   The title is one line so every long name can scroll left without truncation. */
#results .r-meta { flex:1 1 0; width:0; min-width:0; overflow:hidden; }
#results .r-title-clip { position:relative; display:block; width:100%; min-width:0; overflow:hidden; white-space:nowrap; contain:paint; }
#results .r-title {
  display:inline-block; width:max-content; max-width:none; min-width:0;
  white-space:nowrap; overflow:visible; -webkit-line-clamp:unset;
  -webkit-box-orient:initial; vertical-align:middle; will-change:transform;
}
#results .r-sub { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
/* All guest request buttons use a geometry-centered '+' glyph; the text remains
   available in the button and aria-label for screen readers. Check and pending
   states keep their own text and are also centered. */
.add-btn { position:relative; display:grid!important; place-items:center!important; text-align:center; padding:0!important; line-height:1!important; }
.add-btn[data-add-symbol="plus"] { font-size:0!important; }
.add-btn[data-add-symbol="plus"]::before,
.add-btn[data-add-symbol="plus"]::after {
  content:""; position:absolute; display:block; background:currentColor; border-radius:2px;
  pointer-events:none; left:50%; top:50%; transform:translate(-50%,-50%);
}
.add-btn[data-add-symbol="plus"]::before { width:14px; height:2px; }
.add-btn[data-add-symbol="plus"]::after { width:2px; height:14px; }

/* V1.0.8.22: concealed four-character guest blacklist PIN dialog. */
#guest-blacklist-pin-backdrop {
  position:fixed;inset:0;z-index:2000;display:flex;
  align-items:center;justify-content:center;
  padding:16px;background:rgba(0,0,0,.82);
}
#guest-blacklist-pin-dialog {
  width:min(100%,380px);max-height:calc(100dvh - 32px);overflow-y:auto;
  background:#211b20;border:1px solid #b28a54;border-radius:14px;
  padding:22px 19px;box-shadow:0 18px 60px #000c;
  color:#f0e7dc;font-family:var(--sans);
}
#guest-blacklist-pin-title {font-size:20px;line-height:1.4;margin:0 0 8px;color:#f3d7a1;}
#guest-blacklist-pin-help {font-size:13px;color:#c7bbb6;margin:0 0 15px;line-height:1.5;}
#guest-blacklist-pin-input {
  display:block;box-sizing:border-box;width:100%;height:53px;min-width:0;
  border:1px solid #b28a54;border-radius:9px;
  padding:7px 12px;background:#131216;color:#f9f0e9;
  font:600 25px/1.3 var(--sans);letter-spacing:10px;text-align:center;
  -webkit-text-security:disc;
}
#guest-blacklist-pin-input:focus-visible {outline:2px solid #e9a351;outline-offset:2px;}
#guest-blacklist-pin-error {min-height:17px;margin:7px 0 0;color:#ffb9ac;font-size:12px;line-height:1.4;}
.guest-blacklist-pin-actions {display:flex;justify-content:flex-end;gap:10px;margin-top:10px;}
.guest-blacklist-pin-actions button {min-width:92px;min-height:42px;padding:8px 12px;
  border-radius:9px;border:1px solid #8b6e4f;cursor:pointer;font:600 14px/1.3 var(--sans);}
.guest-blacklist-pin-cancel {background:#312a30;color:#e8e0db;}
.guest-blacklist-pin-confirm {background:#f0a047;color:#20150f!important;}
@media (max-width:400px){#guest-blacklist-pin-dialog{padding:17px 15px;}}

/* V1.0.8.25: Prevent accidental double-tap zoom without disabling
   vertical swipe, category scrolling, or accessibility pinch zoom. */
html, body, #results, #queue, #ranking-list, .category-results {
  touch-action: manipulation;
}
@media (max-width:768px) and (pointer:coarse) {
  input, textarea {font-size:max(16px,1em);}
}

/* V1.0.8.30: full-screen session-expired lock, no browsing through it. */
#guest-visit-banner[hidden]{display:none!important;}
#guest-visit-banner{
  position:fixed;inset:0;z-index:2147483000;display:flex;
  align-items:center;justify-content:center;padding:24px;
  background:rgba(10,9,12,.92);backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);overscroll-behavior:contain;
  touch-action:none;user-select:none;
}
.guest-session-expired, .guest-session-expired body{overflow:hidden!important;}
.guest-visit-card{
  width:min(100%,380px);padding:32px 23px;border-radius:18px;
  background:#251e27;border:1px solid #826b56;box-shadow:0 12px 45px #000a;
  text-align:center;color:#fff8e9;line-height:1.65;
}
.guest-visit-icon{display:block;font-size:42px;margin-bottom:14px;}
.guest-visit-card h2{font:700 20px/1.45 var(--sans);margin:0 0 16px;}
.guest-visit-card p{font:400 14px/1.7 var(--sans);color:#c9b8a6;}


/* V1.0.8.48: permanent trial notice inside the existing blank below bookings.
   Keep it OUTSIDE #queue so queue updates, sorting, cancelling and list
   scrolling cannot erase or displace it. It stays at the blank's bottom. */
#queue-bottom-space {
  display:flex;
  flex-direction:column;
  align-items:stretch;
  justify-content:flex-end;
  padding:16px 10px 16px;
  pointer-events:none;
  box-sizing:border-box;
}
#guest-queue-notice {
  flex:0 0 auto;
  width:100%;
  max-width:640px;
  margin-inline:auto;
  text-align:center;
  color:#e6d9d6;
  font:450 clamp(14px,1.6vw,15px)/1.55 var(--sans);
  overflow-wrap:anywhere;
  user-select:text;
}
#guest-queue-notice h3 {
  color:#fff0db;
  font:700 clamp(16px,1.8vw,18px)/1.45 var(--sans);
  margin:0 0 7px;
}
#guest-queue-notice p { margin:0 0 4px; }
#guest-queue-notice .guest-notice-version {
  color:#c6b6b4;
  font:500 11px/1.5 var(--sans);
  letter-spacing:.025em;
  margin-top:9px;
  font-variant-numeric:tabular-nums;
}
@media(max-width:480px){
  #queue-bottom-space { padding-left:8px; padding-right:8px; }
  #guest-queue-notice { font-size:14px; line-height:1.55; }
  #guest-queue-notice h3 { font-size:17px; }
  #guest-queue-notice .guest-notice-version { font-size:11px; }
}
