/* Draw a Song, v2 additions (plus.js): the top bar, My songs, song links, the post kit, plus a few finishing touches.
   Uses the app's own colours and fonts (the variables in index.html). */

/* ---------- finishing touches on what was already there ---------- */
.btn, .chip, .sw, .pagebtn, .zbtn, .srow, .gcard, .donebtn { -webkit-tap-highlight-color: transparent; }
.chip { transition: transform .1s ease-out, background-color .15s, border-color .15s; }
.chip:active { transform: scale(.975); }
.chip.primary { box-shadow: 0 6px 18px rgba(255, 92, 138, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.btn.hot { box-shadow: 0 6px 18px rgba(255, 92, 138, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.btn { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.sw:active { transform: scale(.9); }
.paper { transition: box-shadow .3s; }
@media (hover: hover) {
  .btn:not(:disabled):not([aria-pressed="true"]):not(.hot):hover { background: var(--night-3); }
  .sw:hover { transform: scale(1.08); }
  .sw[aria-pressed="true"]:hover { transform: scale(1.12); }
  .srow:hover, .gcard:hover { background-color: rgba(255, 255, 255, 0.04); }
  .chip:not(.primary):hover { border-color: #4a5190; }
}

/* ---------- the top bar ---------- */
.xbar { flex: none; height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; max-width: 560px; margin: 0 auto; padding: 0 2px; }
.xbrand { font-size: 27px; color: var(--text); transform: translateY(-1px); }
.xbar-btns { display: flex; gap: 8px; }
.xpill {
  height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 13px 0 11px; border-radius: 999px;
  border: 1px solid var(--rim); background: rgba(27, 31, 59, 0.82); color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform .1s ease-out, background-color .15s; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.xpill svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.xpill:active { transform: scale(.95); }
@media (hover: hover) { .xpill:hover { background: var(--night-3); } }
body.piano .xbar, body.xsharing .xbar { display: none; }
@media (min-width: 640px) and (min-aspect-ratio: 1/1) {
  .panel > .xbar { max-width: none; margin: -2px 0 2px; justify-content: flex-start; padding: 0; }
  .panel > .xbar .xbrand { display: none; } /* the big name is right above */
}

/* ---------- toast ---------- */
.xtoast {
  position: fixed; left: 50%; bottom: max(26px, calc(env(safe-area-inset-bottom, 0px) + 18px)); z-index: 90; transform: translateX(-50%);
  max-width: min(calc(100vw - 32px), 420px); padding: 11px 18px; border-radius: 999px; background: #f3f0ff; color: #12152a;
  font-size: 14.5px; font-weight: 650; text-align: center; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45); pointer-events: none;
}
.xtoast.in { animation: xToast .28s cubic-bezier(.16, 1, .3, 1); }
@keyframes xToast { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- sheets ---------- */
.xscrim { position: fixed; inset: 0; z-index: 44; background: var(--scrim); animation: xFade .2s ease-out; }
@keyframes xFade { from { opacity: 0; } to { opacity: 1; } }
.gsheet.xsheet { z-index: 45; }
.xsheet .sheet-head { display: flex; }
.xsheet .grabber { display: block; }
.xsheet .sbody { padding-top: 4px; }

/* ---------- My songs ---------- */
.xgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 460px) { .xgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.xcard { position: relative; display: flex; flex-direction: column; min-width: 0; border-radius: 16px; background: var(--night-2); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.xcard[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.xopen { display: block; width: 100%; padding: 8px 8px 0; border: 0; background: none; cursor: pointer; border-radius: 16px 16px 0 0; }
.xthumb { display: block; width: 100%; height: auto; border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); transition: transform .15s ease-out; }
.xopen:active .xthumb { transform: scale(.97); }
.xmeta { display: flex; align-items: center; gap: 4px; padding: 8px 4px 9px 12px; min-height: 52px; }
.xwho { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.xname { font-size: 14.5px; font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xwho small { font-size: 12.5px; color: var(--muted); }
.xcard[aria-current="true"] .xwho small { color: var(--accent); font-weight: 600; }
.xmore { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.xmore svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.xmore:active { background: rgba(255, 255, 255, 0.08); }
.xrename { width: 100%; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--accent); background: var(--night); color: var(--text); font: inherit; font-size: 14.5px; font-weight: 600; outline: none; }
.xmenu {
  position: absolute; right: 6px; bottom: 50px; z-index: 3; min-width: min(190px, calc(100% - 12px)); padding: 5px; display: flex; flex-direction: column;
  background: rgba(38, 43, 82, 0.97); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); transform-origin: bottom right; animation: pmIn .18s cubic-bezier(.32, .72, 0, 1);
}
.xmenu button { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: 15px; font-weight: 550; text-align: left; cursor: pointer; }
.xmenu button svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.xmenu button:active, .xmenu button:focus-visible { background: rgba(255, 255, 255, 0.1); outline: none; }
.xmenu button.danger { color: #ff7b6e; }
.xmenu button.danger.armed { background: #e4503c; color: #fff; }
.xcard.xnew { align-items: center; justify-content: center; gap: 10px; min-height: 150px; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer;
  box-shadow: none; outline: 2px dashed rgba(255, 255, 255, 0.2); outline-offset: -2px; transition: background-color .15s; }
.xcard.xnew:active { background: rgba(255, 255, 255, 0.05); }
.xcard.xnew b { font-size: 15px; font-weight: 650; }
.xplus { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px rgba(255, 92, 138, 0.35); }
.xplus svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.xnote { margin: 12px 4px 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
.xsec { margin: 22px 4px 10px; font-size: 16px; font-weight: 700; color: var(--text); }
.xrow { display: flex; gap: 10px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.xrow::-webkit-scrollbar { display: none; }
.xex { flex: none; width: 104px; display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.xex span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xex:active .xthumb { transform: scale(.96); }

/* ---------- the song link sheet ---------- */
.xlink { display: flex; gap: 14px; align-items: center; }
.xlink-pic { flex: none; width: 104px; transform: rotate(-3deg); }
.xlink-side { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.xlink-text { margin: 0; font-size: 16px; line-height: 1.4; color: var(--text); }
.xlink-note { margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--gold); font-weight: 600; }
.xlink-url { width: 100%; height: 44px; margin: 16px 0 10px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--rim); background: var(--night); color: var(--muted); font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-overflow: ellipsis; }
.xlink-actions { display: flex; gap: 10px; }
.xlink-actions .chip { flex: 1; gap: 8px; }
.xlink-actions .chip svg, .xshared .chip svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.xshared .chip svg.fill { fill: currentColor; }

/* ---------- a song someone sent: the card under the paper ---------- */
.xshared {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 22; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 18px max(18px, env(safe-area-inset-bottom, 0px)); border-radius: 26px 26px 0 0; background: #0e1022;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07); animation: xUp .4s cubic-bezier(.32, .72, 0, 1);
}
@keyframes xUp { from { transform: translateY(100%); } to { transform: none; } }
.xshared h2 { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; text-wrap: balance; }
.xshared p { margin: 0 0 8px; font-size: 15px; line-height: 1.45; color: var(--muted); }
.xshared-actions { display: flex; flex-direction: column; gap: 8px; }
.xshared .chip { gap: 8px; }
body.xsharing .panel { visibility: hidden; } /* their two choices are on the card */
@media (min-width: 640px) and (min-aspect-ratio: 1/1) {
  .xshared { left: auto; right: max(20px, calc(50vw - 520px)); bottom: 24px; width: 380px; border-radius: 22px; }
}

/* ---------- post kit ---------- */
.xkit { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); }
.modal p.xkit-h { font-size: 15px; font-weight: 700; color: var(--text); }
.modal p.xkit-cap { font-size: 14.5px; line-height: 1.45; color: var(--text); -webkit-user-select: text; user-select: text; }
.xkit-row { display: flex; gap: 8px; }
.xkit-row .chip:first-child { flex: 1; justify-content: center; }
.xkit-next { width: 38px; padding: 0; justify-content: center; }
.xkit-next svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.xkit-bio { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.xkit-biot { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; color: var(--muted); }
.xkit-biot b { font-size: 14.5px; font-weight: 650; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (prefers-reduced-motion: reduce) {
  .xtoast.in, .xscrim, .xshared, .xmenu { animation: none; }
  .chip, .xpill, .xthumb { transition: none; }
}

/* a sent song: only the paper and the card (no games, paper menu or zoom buttons) */
body.xsharing #gameBtn, body.xsharing #pageBtn, body.xsharing #pagePop, body.xsharing .zbtn { display: none; }


/* pop-up titles break into even lines (no lone "E-" at a line end) */
.passset h2, .linklive h2, .linkask h2, .openin h2 { text-wrap: balance; }

/* ---------- the free test: a plain bar at the top of the paper, emptying as the minute is used (index.html, "access") ---------- */
.tastebar { position: absolute; left: 50%; top: 14px; z-index: 4; transform: translateX(-50%); width: min(44%, 170px); height: 7px; border-radius: 999px; overflow: hidden;
  background: rgba(18, 21, 42, 0.5); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2); pointer-events: none; }
.tastebar i { display: block; height: 100%; width: 100%; border-radius: 999px; transform-origin: left center; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: transform .25s linear; }
.tastebar.low i { background: var(--accent); }
@media (prefers-reduced-motion: reduce) { .tastebar i { transition: none; } }

/* ---------- the paywall: everything still there, in less height; the button, its price and "Not now" never scroll away.
   The small print (cancel line, Terms, Privacy) is the very last thing, under "Not now". ---------- */
#paywall { gap: 9px; padding: 14px 16px 12px; }
#paywall p.pitch { margin: 0; font-size: clamp(19px, 5.6vw, 23px); line-height: 1.15; }
#paywall > p:not(.pitch):not(.fine):not(.fit) { font-size: 14.5px; line-height: 1.35; }
#paywall .perks { gap: 4px; font-size: 14.5px; }
#paywall .perks li { line-height: 1.3; }
#paywall .plan { padding: 9px 4px; }
#paywall .plan b { font-size: 16.5px; }
#paywall .plan small { font-size: 14.5px; }
#paywall .plans .plan:last-child { border-bottom: 0; }
#paywall .fine { font-size: 12.5px; line-height: 1.35; }
#paywall .pw-small { color: var(--muted); }
#paywall .pw-small .legal { white-space: nowrap; }
.pw-foot { position: sticky; bottom: 0; z-index: 1; display: flex; flex-direction: column; gap: 7px; margin: 0 -16px; padding: 10px 16px 6px;
  background: var(--night-2); box-shadow: 0 -10px 14px -8px rgba(0, 0, 0, 0.45); border-top: 1px solid rgba(255, 255, 255, 0.06); }
.pw-foot .chip.big { height: 50px; }
#paywall .pw-foot p.terms { margin: 0; font-size: 13.5px; line-height: 1.3; }
@media (max-height: 640px) {
  #paywall { gap: 7px; padding-top: 12px; }
  #paywall .perks { font-size: 14px; gap: 3px; }
  #paywall .plan { padding: 7px 4px; }
  .pw-foot { padding: 8px 16px 4px; gap: 5px; }
  .pw-foot .chip.big { height: 46px; }
}
/* Sliders react to their ball only: they let touches and clicks through (a touch on the track scrolls the page like any
   other place), and plus.js takes hold of the ball when a press starts on it. */
html.ball-only input[type="range"] { pointer-events: none; }

/* the top bar's brand: the logo and the name, as in the main menu */
.xbrand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.xbrand .hub-logo { width: 26px; height: 26px; border-radius: 7px; }
.xbrand .hub-name { font-size: 18px; }
