:root {
  --bg: #f4fafa;
  --text: #46575c;
  --muted: #6f7f84;
  --accent: #e8705a;
  --accent-ink: #ffffff;
  --panel: #d5ecec;
  --panel-ink: #3b4b50;
  --line: #d5e6e6;
  --surface: #ffffff;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141c1e;
    --text: #d7e2e3;
    --muted: #93a3a6;
    --panel: #20393b;
    --panel-ink: #d7e8e8;
    --line: #2b3a3d;
    --surface: #1b2527;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

.wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 16px 16px 64px;
}

@media (min-width: 720px) {
  .wrap { padding: 16px 40px 80px; }
}

/* header */
.brand a {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  font-size: 32px;
  font-weight: 500;
  padding: 12px 0;
}
.brand img { width: 52px; height: 52px; border-radius: 50%; }
.brand b { color: var(--accent); font-weight: 500; }

/* catalogue */
.page-title {
  font-weight: 400;
  font-size: clamp(40px, 6vw, 64px);
  margin: 40px 0 16px;
  letter-spacing: -0.5px;
}
.lead {
  color: var(--muted);
  font-size: clamp(17px, 1.6vw, 22px);
  line-height: 1.6;
  margin: 0 0 40px;
}

.grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 16px;
}
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px; } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  display: block;
  text-decoration: none;
}
.card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 7%;
  transition: transform .15s ease, box-shadow .15s ease;
}
/* No hover lift on touch screens: there it sticks after a tap. */
@media (hover: hover) {
  .card:hover img {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(30, 50, 55, .15);
  }
}
.card:focus-visible img {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(30, 50, 55, .15);
}
.card:focus-visible { outline: none; }
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}
.card-title { font-size: clamp(17px, 1.6vw, 22px); font-weight: 500; }

/* service badge */
.badge {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #8a979b;
  line-height: 1;
}
.badge-spotify { background: #1ed760; color: #000; }
.badge-yandex { background: #ffcc00; color: #000; }
.badge-deezer { background: #a238ff; }
.badge-apple { background: #fa2d48; }
.badge-youtube { background: #ff0033; }

/* vibe page */
.back {
  display: inline-block;
  margin: 28px 0 24px;
  color: var(--muted);
  font-size: 19px;
  text-decoration: none;
}
.back:hover { color: var(--text); }

.vibe {
  display: grid;
  gap: 28px;
  align-items: start;
}
.vibe > * { min-width: 0; }
@media (min-width: 900px) {
  .vibe { grid-template-columns: 1fr 1fr; gap: 52px; }
}

.vibe-preview {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 7%;
}

.vibe-title {
  font-weight: 400;
  font-size: clamp(36px, 4.5vw, 58px);
  margin: 0 0 24px;
  letter-spacing: -0.3px;
}
.vibe-desc { color: var(--muted); font-size: 19px; line-height: 1.5; margin: -8px 0 24px; }

.json-panel {
  position: relative;
  background: var(--panel);
  color: var(--panel-ink);
  border-radius: 22px;
  padding: 18px 20px 20px;
  font-family: var(--mono);
}
.json-label { font-size: 14px; color: var(--muted); }
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  background: var(--surface);
  color: var(--text);
  font: 500 18px "Barlow", system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.copy-btn:active { transform: scale(.97); }
.copy-btn.is-done { color: #1f9d55; }
.copy-btn.is-failed { color: #c0392b; }

.json-panel div.highlight,
.json-panel pre { margin: 0; background: none; border: 0; padding: 0; }
.json-panel pre {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}
.json-panel code { font-family: inherit; background: none; padding: 0; }
.json-panel .highlight span { color: inherit; font-style: normal; font-weight: normal; }

.playlist {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 30px;
  padding: 14px 20px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  text-decoration: none;
  background: transparent;
}
.playlist:hover { border-color: var(--muted); }
.playlist .badge { width: 38px; height: 38px; font-size: 18px; }
.playlist-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.playlist-title { font-size: 20px; font-weight: 500; }
.playlist-url {
  font-size: 15px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.playlist-arrow { font-size: 22px; color: var(--muted); }

.open-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 30px;
  min-height: 74px;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 22px;
  font-weight: 500;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.open-btn:hover { filter: brightness(1.04); }
.open-btn:active { transform: scale(.99); }
.open-btn img { width: 42px; height: 42px; border-radius: 50%; }
.open-btn.is-disabled { opacity: .5; pointer-events: none; }

/* Phones: the "open in Paslen" button goes right under the title instead of after
   several screens of JSON; the JSON moves to the end in a smaller font. */
@media (max-width: 899px) {
  .vibe-side { display: flex; flex-direction: column; }
  .vibe-title { margin-bottom: 16px; }
  .vibe-desc { margin: -4px 0 0; }
  .vibe-side .open-btn { margin-top: 24px; }
  .json-panel { order: 1; margin-top: 30px; }
}
@media (max-width: 599px) {
  .vibe-desc { font-size: 17px; }
  .open-btn { min-height: 64px; gap: 12px; font-size: 20px; }
  .open-btn img { width: 36px; height: 36px; }
  .playlist { gap: 12px; padding: 12px 16px; }
  .playlist-title { font-size: 18px; }
  .json-panel { border-radius: 18px; padding: 14px 14px 16px; }
  .json-panel pre { margin-top: 20px; font-size: 13px; line-height: 1.6; }
  .copy-btn { padding: 7px 16px; font-size: 16px; }
}

.open-page { max-width: 560px; margin: 0 auto; text-align: center; }
.open-page .open-btn { margin-top: 32px; }
.open-hint { text-align: center; color: var(--muted); font-size: 15px; margin: 10px 0 0; }
.get-app { text-align: center; color: var(--muted); font-size: 16px; margin: 16px 0 0; }

.lead a, .json-label a { color: var(--accent); }
.json-label a { text-decoration: none; }
.json-label a:hover { text-decoration: underline; }

/* schema / docs page */
.doc { max-width: 1100px; }
.doc h1 {
  font-weight: 400;
  font-size: clamp(36px, 5vw, 58px);
  margin: 0 0 16px;
  letter-spacing: -0.3px;
}
.doc h2 { font-weight: 500; font-size: 28px; margin: 48px 0 16px; }
.doc h3 { font-weight: 500; font-size: 22px; margin: 32px 0 12px; }
.doc h4 { font-weight: 500; font-size: 19px; margin: 28px 0 10px; }
.doc ul { font-size: 18px; line-height: 1.6; color: var(--muted); padding-left: 22px; }
.doc a { color: var(--accent); overflow-wrap: anywhere; }

.agent-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin: 0 0 32px;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  color: var(--muted);
  font-size: 16px;
}
.agent-bar a { color: var(--accent); font-size: 18px; }
.agent-bar span { flex: 1 1 260px; }
.agent-btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 500 18px "Barlow", system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.agent-btn:active { transform: scale(.98); }
.doc p { font-size: 19px; line-height: 1.6; color: var(--muted); }
.doc strong { color: var(--text); font-weight: 500; }

.doc code {
  font-family: var(--mono);
  font-size: .85em;
  overflow-wrap: anywhere;
  background: var(--panel);
  color: var(--panel-ink);
  padding: 2px 6px;
  border-radius: 6px;
}

.doc div.highlighter-rouge {
  position: relative;
  background: var(--panel);
  color: var(--panel-ink);
  border-radius: 22px;
  padding: 56px 20px 20px;
  margin: 24px 0;
}
.doc div.highlighter-rouge .highlight,
.doc div.highlighter-rouge pre { margin: 0; padding: 0; background: none; border: 0; }
.doc div.highlighter-rouge pre {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.doc div.highlighter-rouge code { background: none; padding: 0; font-size: inherit; border-radius: 0; }
.doc div.highlighter-rouge .highlight span { color: inherit; font-style: normal; font-weight: normal; }

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 17px;
}
.doc th, .doc td {
  text-align: left;
  vertical-align: top;
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--line);
}
.doc th { font-weight: 500; color: var(--muted); }
.doc td { overflow-wrap: anywhere; }
.doc td:first-child { white-space: nowrap; overflow-wrap: normal; }
.doc th:last-child, .doc td:last-child { padding-right: 0; }

@media (max-width: 599px) {
  .doc p { font-size: 17px; }
  .doc ul { font-size: 17px; }
  .doc h2 { font-size: 24px; margin-top: 40px; }
  .doc table { font-size: 15px; }
  .doc th, .doc td { padding-right: 10px; }
  .doc div.highlighter-rouge { border-radius: 18px; padding: 52px 14px 16px; }
  .doc div.highlighter-rouge pre { font-size: 12.5px; line-height: 1.6; }
}
