/* 2mecho web — minimal ink/paper player (mirrors iOS Palette + popnota style) */
:root {
  --ink: #141414;
  --paper: #ffffff;
  --surface: #ffffff;
  --hairline: rgba(20, 20, 20, 0.12);
  --danger: #d94545;
  --ink-55: rgba(20, 20, 20, 0.55);
  --ink-40: rgba(20, 20, 20, 0.40);
  --ink-30: rgba(20, 20, 20, 0.30);
  --ink-08: rgba(20, 20, 20, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ededed;
    --paper: #141414;
    --surface: #1c1c1c;
    --hairline: rgba(237, 237, 237, 0.16);
    --ink-55: rgba(237, 237, 237, 0.55);
    --ink-40: rgba(237, 237, 237, 0.40);
    --ink-30: rgba(237, 237, 237, 0.30);
    --ink-08: rgba(237, 237, 237, 0.08);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* Screens */
.screen {
  position: fixed; inset: 0; display: none;
  flex-direction: column;
  opacity: 0; transition: opacity .35s ease;
}
.screen.show { display: flex; opacity: 1; }
#splash.show, #login.show, #landing.show { align-items: center; justify-content: center; }

/* Echo mark (SVG injected by JS) */
.echomark { display: inline-block; line-height: 0; }
.echomark svg { display: block; }
.pulse svg { animation: pulse 2.8s ease-in-out infinite; transform-origin: center; }
@keyframes pulse { 0%,100% { transform: scale(.97);} 50% { transform: scale(1.03);} }

.wordmark { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.wordmark.lg { font-size: 34px; margin: 4px 0 0; }
.splash-inner, .login-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }

/* Login */
.login-inner { width: 100%; max-width: 420px; padding: 0 32px; }
.blurb { color: var(--ink-55); font-size: 14px; margin: 0; }
.login-actions { width: 100%; margin-top: 28px; display: flex; flex-direction: column; gap: 12px; }
.login-footer { color: var(--ink-40); font-size: 12px; margin-top: 30px; }

/* Pills / buttons */
.pill {
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 14px 20px; font-size: 16px; font-weight: 600;
  width: 100%; transition: opacity .15s, background .15s;
}
.pill.filled { background: var(--ink); color: var(--paper); }
.pill:disabled { opacity: .45; cursor: default; }
.pill.block { width: 100%; }
.pill.prov { display: flex; align-items: center; justify-content: center; gap: 10px; }
.prov-ic { width: 18px !important; height: 18px !important; flex: 0 0 auto; }
.link-btn { background: none; border: none; color: var(--ink-55); font-size: 13px; font-weight: 500; margin-top: 8px; }
.err-line { color: var(--danger); font-size: 13px; min-height: 16px; text-align: center; margin: 8px 0 0; }

/* Modal / email card */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: none; align-items: center; justify-content: center; padding: 24px; z-index: 40;
}
.modal-scrim.show { display: flex; }
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 22px; padding: 24px; width: 100%; max-width: 340px; position: relative; }
.card h2 { font-size: 17px; font-weight: 600; margin: 0 0 16px; }
.close-x { position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--ink-40); font-size: 16px; }
.underline {
  width: 100%; border: none; border-bottom: 1px solid var(--hairline); background: transparent;
  color: var(--ink); font-size: 17px; padding: 8px 0 8px; outline: none; margin-bottom: 18px;
}
.underline::placeholder { color: var(--ink-30); }
.muted { color: var(--ink-55); font-size: 13px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 10px 6px;
}
.icon-btn { background: none; border: none; color: var(--ink); padding: 8px; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.ic { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 17px; height: 17px; stroke: var(--ink-55); stroke-width: 1.6; }
.ic-fill { width: 24px; height: 24px; fill: var(--ink); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }

.group-rail, .tag-rail {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  flex: 1; padding: 2px 2px;
}
.group-rail::-webkit-scrollbar, .tag-rail::-webkit-scrollbar { display: none; }
.tag-rail { flex: 0 0 auto; padding: 6px 12px 10px; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--hairline); background: transparent; color: var(--ink-55);
  border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: all .15s;
}
.chip.active { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.group-chip { font-weight: 600; font-size: 15px; padding: 6px 10px; border: none; }
.group-chip.active { background: transparent; color: var(--ink); border: none; text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
.group-chip:not(.active) { color: var(--ink-40); }

/* Player */
.player {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 28px calc(24px + env(safe-area-inset-bottom)); gap: 18px; min-height: 0;
  touch-action: pan-y;
}
.cover-wrap {
  position: relative; width: min(72vw, 320px); aspect-ratio: 1; border-radius: 20px; overflow: hidden;
  border: 1px solid var(--hairline); background: var(--surface); box-shadow: 0 10px 40px rgba(0,0,0,.12);
}
#cover { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
#cover.loaded { opacity: 1; }
.cover-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: .35; }
.meta { text-align: center; max-width: 100%; }
.title { font-size: 20px; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.artist { font-size: 14px; color: var(--ink-55); margin-top: 4px; }

.progress { width: min(72vw, 320px); height: 4px; background: var(--ink-08); border-radius: 4px; position: relative; cursor: pointer; }
.progress-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ink); border-radius: 4px; }
.times { width: min(72vw, 320px); display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-40); margin-top: -8px; }

.controls { display: flex; align-items: center; gap: 34px; }
.ctl { background: none; border: none; color: var(--ink); display: flex; align-items: center; justify-content: center; padding: 6px; }
.ctl.play { width: 68px; height: 68px; border-radius: 999px; border: 1.5px solid var(--ink); }
.ctl.play .ic-fill { width: 30px; height: 30px; }
.ctl:disabled { opacity: .35; }

/* Secondary control row: dislike · repeat-one · lyrics · quality · share */
.ctl-row { display: flex; align-items: center; justify-content: space-between; width: min(72vw, 320px); margin-top: 4px; }
.mini { background: none; border: none; color: var(--ink-55); width: 42px; height: 34px; display: flex; align-items: center; justify-content: center; padding: 0; }
.mini svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mini:active { color: var(--ink); }
.mini.active { color: var(--ink); }
.quality-pill { background: none; border: 1.3px solid var(--ink-30); color: var(--ink-55); border-radius: 999px; font-size: 12px; font-weight: 600; padding: 5px 11px; white-space: nowrap; }

.trial-banner { display: flex; align-items: center; justify-content: space-between; width: 100%; background: var(--ink-08); border: none; border-bottom: 1px solid var(--hairline); color: var(--ink); padding: 10px 20px; font-size: 13px; font-weight: 500; }
.trial-banner .trial-cta { font-weight: 700; }
#lang-top-btn .ic { stroke-width: 1.5; }

/* Lyrics sheet */
.lyrics-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; height: 78vh; z-index: 30;
  background: var(--paper); border-top: 1px solid var(--hairline);
  border-radius: 22px 22px 0 0; transform: translateY(105%); transition: transform .3s ease;
  display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom);
}
.lyrics-sheet.show { transform: translateY(0); }
.lyrics-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px; position: relative; }
.lyrics-body { flex: 1; overflow-y: auto; padding: 8px 24px 40px; text-align: center; }
.lyrics-line { font-size: 18px; line-height: 1.9; color: var(--ink-30); transition: color .2s, font-weight .2s; }
.lyrics-line.active { color: var(--ink); font-weight: 700; }
.lyrics-line.plain { color: var(--ink); opacity: .85; }

/* Overlays */
.overlay { position: fixed; inset: 0; background: var(--paper); z-index: 50; display: none; flex-direction: column; }
.overlay.show { display: flex; }

/* Search */
.search-bar { display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 12px 8px 4px; }
.search-field { flex: 1; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--hairline); border-radius: 999px; }
.search-field input { flex: 1; border: none; background: transparent; color: var(--ink); font-size: 16px; outline: none; }
.search-field input::placeholder { color: var(--ink-30); }
.search-results { flex: 1; overflow-y: auto; padding: 8px 0 30px; }
.search-results .hint { text-align: center; color: var(--ink-40); font-size: 15px; margin-top: 40px; }
.result-row { display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.result-row:active { background: var(--ink-08); }
.result-row img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface); flex: 0 0 auto; }
.result-row .r-meta { flex: 1; min-width: 0; }
.result-row .r-title { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-row .r-artist { font-size: 13px; color: var(--ink-55); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-play { width: 14px; height: 15px; fill: var(--ink-55); flex: 0 0 auto; }

/* Paywall */
.paywall { flex: 1; display: flex; flex-direction: column; position: relative; }
.paywall-close { top: max(14px, env(safe-area-inset-top)); }
.paywall-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 28px 32px; gap: 18px; }
.paywall h1 { font-size: 24px; font-weight: 700; margin: 6px 0 0; }
.benefits { list-style: none; padding: 0; margin: 6px 0; text-align: left; width: 100%; max-width: 360px; }
.benefits li { position: relative; padding-left: 18px; font-size: 15px; color: var(--ink); opacity: .85; margin: 10px 0; }
.benefits li::before { content: ""; position: absolute; left: 0; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.plans { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.plan {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 16px;
  border: 1.4px solid var(--ink-30); background: transparent; color: var(--ink); text-align: left;
}
.plan.active { border-color: var(--ink); border-width: 2px; }
.plan .radio { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--ink-40); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.plan.active .radio { border-color: var(--ink); }
.plan.active .radio::after { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--ink); }
.plan .p-label { font-size: 16px; font-weight: 600; flex: 1; }
.plan .p-price { font-size: 16px; font-weight: 500; color: var(--ink-55); }
.plan .p-sub { display: block; font-size: 12px; font-weight: 400; color: var(--ink-40); }
#subscribe-btn { max-width: 360px; }
.legal { font-size: 12px; color: var(--ink-40); }
.legal a { text-decoration: none; }

/* Sheets (account / language) */
.sheet { margin-top: auto; background: var(--surface); border-radius: 22px 22px 0 0; border-top: 1px solid var(--hairline); padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); max-height: 88vh; display: flex; flex-direction: column; }
.overlay > .sheet { animation: sheet-up .28s ease; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; position: relative; }
.sheet-head h2 { font-size: 18px; font-weight: 700; margin: 0; }
.sheet-head .close-x { position: static; }
.account-body { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; }
.acct-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; font-size: 15px; border-bottom: 1px solid var(--hairline); }
.row-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; background: none; border: none; color: var(--ink); font-size: 15px; padding: 15px 4px; border-bottom: 1px solid var(--hairline); text-decoration: none; }
.row-btn.danger { color: var(--danger); }
.row-btn .chev { color: var(--ink-40); font-size: 20px; }
.acct-footer { text-align: center; color: var(--ink-40); font-size: 12px; padding: 16px 4px 4px; }
.lang-hint { padding: 4px 4px 10px; }
.lang-list { overflow-y: auto; }
.lang-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px; font-size: 15px; border-bottom: 1px solid var(--hairline); }
.lang-item .tick { width: 20px; height: 20px; border: 1.5px solid var(--ink-30); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--paper); }
.lang-item.on .tick { background: var(--ink); border-color: var(--ink); }
#lang-save { margin-top: 16px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: 999px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 100; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--danger); }

/* Spinner */
.spinner { width: 22px; height: 22px; border: 2px solid var(--ink-30); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-msg { text-align: center; color: var(--ink-40); font-size: 15px; margin-top: 40px; }

@media (min-width: 720px) {
  .cover-wrap { width: 340px; }
  .progress, .times, .ctl-row { width: 340px; }

  /* Lyrics as a right-side panel; player slides into the left half. */
  .lyrics-sheet {
    left: auto; right: 0; top: 0; bottom: 0; height: 100%;
    width: min(42vw, 520px); border-radius: 0;
    border-top: none; border-left: 1px solid var(--hairline);
    transform: translateX(103%);
  }
  .lyrics-sheet.show { transform: translateX(0); }
  .lyrics-head { padding: 22px 24px 10px; }
  .lyrics-body { text-align: left; padding-left: 32px; }
  #app.lyrics-open .player { padding-right: min(42vw, 520px); transition: padding .32s ease; }
  #app.lyrics-open .tag-rail,
  #app.lyrics-open .trial-banner { padding-right: min(42vw, 520px); transition: padding .32s ease; }
}
