:root {
  color-scheme: light;
  --ink: #101010;
  --muted: #737782;
  --line: #e5e8ee;
  --surface: #ffffff;
  --wash: #f3f5f8;
  --teal: #0b8f84;
  --amber: #f4bf45;
  --coral: #ff6748;
  --blue: #3c66ff;
  --shadow: 0 22px 70px rgba(18, 20, 27, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #e9edf3;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 450px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 22px);
  background:
    linear-gradient(180deg, #101010 0 206px, transparent 206px),
    linear-gradient(180deg, #f8f9fb 0%, #edf1f7 100%);
}

.topbar,
.top-actions,
.section-row,
.hero-actions,
.platform-shortcuts {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 14px;
  color: #fff;
}

.top-actions {
  gap: 8px;
}

.title-block {
  min-width: 0;
}

.title-block p,
.section-kicker {
  margin: 0;
  color: currentColor;
  font-size: 0.74rem;
  font-weight: 760;
  letter-spacing: 0;
  opacity: 0.62;
}

.title-block h1 {
  margin: 2px 0 0;
  font-size: clamp(1.82rem, 8vw, 2.32rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.sync-pill {
  min-width: 48px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  padding: 8px 9px;
  font-size: 0.74rem;
  font-weight: 780;
  text-align: center;
}

.sync-pill.is-online {
  background: rgba(11, 143, 132, 0.22);
  color: #d7fff9;
}

.icon-button,
.round-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.icon-button {
  color: inherit;
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.submit-button {
  color: var(--ink);
  background: var(--amber);
}

.icon-button svg,
.round-button svg,
.widget-open svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.round-button {
  color: #fff;
  background: var(--ink);
}

.round-button.secondary {
  color: var(--ink);
  background: #eef1f5;
}

.round-button .pause-icon,
.round-button.is-playing .play-icon {
  display: none;
}

.round-button.is-playing .pause-icon {
  display: block;
}

.round-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.hero-track {
  margin-top: 22px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--ink);
  padding: 12px 12px 10px;
  text-align: left;
  cursor: pointer;
}

.artwork {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 103, 72, 0.95), rgba(11, 143, 132, 0.86)),
    #222;
  color: #fff;
  font-weight: 850;
  isolation: isolate;
}

.artwork::after {
  content: "";
  position: absolute;
  inset: 13%;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
}

.artwork img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artwork span {
  z-index: 2;
  font-size: 1.72rem;
}

.artwork.has-image::after,
.artwork.has-image span {
  display: none;
}

.hero-artwork {
  width: 104px;
  height: 104px;
}

.hero-copy {
  display: grid;
  align-content: center;
  min-width: 0;
}

.hero-copy .section-kicker {
  color: var(--teal);
}

.hero-copy strong {
  display: -webkit-box;
  overflow: hidden;
  margin: 6px 0 4px;
  font-size: clamp(1.25rem, 5.8vw, 1.64rem);
  line-height: 1.04;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hero-copy span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-actions {
  gap: 8px;
  padding: 0 12px 12px;
}

.hero-actions .round-button {
  width: 100%;
  flex: 1 1 0;
}

.widget-preview,
.composer,
.current-pair {
  margin-top: 14px;
}

.section-row {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.plain-link {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  text-decoration: none;
}

.home-widget {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 78px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(16, 16, 16, 0.95);
  color: #fff;
  padding: 10px;
  text-align: left;
  box-shadow: 0 14px 38px rgba(18, 20, 27, 0.16);
}

.widget-artwork {
  width: 58px;
  height: 58px;
}

.widget-text {
  min-width: 0;
}

.widget-text strong,
.mini-copy strong,
.result-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-text strong {
  font-size: 1.02rem;
  line-height: 1.15;
}

.widget-text span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.83rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-open {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.82);
}

.composer {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.composer-head .section-kicker,
.widget-preview .section-kicker {
  color: var(--muted);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 142px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1f6;
}

.segment {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
  cursor: pointer;
}

.segment.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(23, 28, 40, 0.12);
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.search-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  outline: none;
}

.search-form input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11, 143, 132, 0.14);
}

.result-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.result-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 7px;
  text-align: left;
  cursor: pointer;
}

.result-artwork {
  width: 54px;
  height: 54px;
}

.result-copy {
  min-width: 0;
}

.result-copy strong {
  margin-bottom: 3px;
  font-size: 0.96rem;
}

.result-copy span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-badge {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 6px 7px;
  font-size: 0.7rem;
  font-weight: 760;
  white-space: nowrap;
}

.platform-shortcuts {
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0;
}

.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 5px 9px 5px 5px;
  font-size: 0.82rem;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.platform-chip span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: #fff;
  font-size: 0.72rem;
}

.platform-chip svg,
.platform-mark svg,
.widget-platforms svg {
  width: 21px;
  height: 21px;
  color: #fff;
}

.loading,
.empty-message {
  min-height: 58px;
  border: 1px dashed #cbd2dc;
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
}

.current-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.mini-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.mini-artwork {
  width: 52px;
  height: 52px;
}

.mini-copy {
  min-width: 0;
}

.mini-copy span {
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 760;
}

.mini-copy strong {
  margin: 3px 0 2px;
  font-size: 0.98rem;
  line-height: 1.15;
}

.mini-copy small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  align-items: end;
  background: rgba(10, 12, 18, 0.54);
  padding: 12px;
}

.platform-sheet[hidden] {
  display: none;
}

.sheet-panel {
  position: relative;
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--ink);
  background: #eef1f5;
}

.sheet-track {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding-right: 50px;
}

.sheet-artwork {
  width: 72px;
  height: 72px;
}

.sheet-track h2 {
  margin: 4px 0 3px;
  overflow: hidden;
  font-size: 1.2rem;
  line-height: 1.14;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-track p:last-child {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-grid {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.platform-link {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  min-height: 50px;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 7px 10px;
  text-decoration: none;
}

.platform-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 850;
}

.platform-link strong {
  display: block;
  font-size: 0.95rem;
}

.platform-link span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 20;
  width: min(calc(100% - 28px), 390px);
  min-height: 44px;
  border-radius: 8px;
  background: #101010;
  color: #fff;
  display: grid;
  place-items: center;
  padding: 10px 14px;
  text-align: center;
  box-shadow: var(--shadow);
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.widget-page {
  min-height: 100svh;
  background: #0c0c0c;
  display: grid;
  place-items: center;
  padding: 18px;
}

.widget-screen {
  width: min(100%, 390px);
}

.os-widget {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 13px;
  width: 100%;
  min-height: 112px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #171717;
  color: #fff;
  padding: 12px;
  text-decoration: none;
  box-shadow: 0 20px 65px rgba(0, 0, 0, 0.34);
}

.os-widget .widget-artwork {
  width: 82px;
  height: 82px;
}

.os-widget-copy {
  display: grid;
  align-content: center;
  min-width: 0;
}

.os-widget-copy span {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.78rem;
  font-weight: 760;
}

.os-widget-copy strong {
  display: -webkit-box;
  overflow: hidden;
  margin: 5px 0 3px;
  font-size: 1.22rem;
  line-height: 1.05;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.os-widget-copy small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-platforms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.widget-platforms a {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 820;
  text-decoration: none;
}

.install-page {
  min-height: 100svh;
  background: #edf1f7;
}

.install-shell {
  width: min(100%, 460px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 22px);
}

.install-head {
  color: var(--ink);
}

.back-link {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 780;
  text-decoration: none;
}

.install-head h1 {
  margin: 8px 0 16px;
  font-size: 2rem;
  line-height: 1.02;
}

.install-grid {
  display: grid;
  gap: 12px;
}

.install-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 16px 42px rgba(18, 20, 27, 0.1);
}

.install-card .section-kicker {
  color: var(--teal);
  margin-bottom: 10px;
}

.install-url {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f7fb;
  color: var(--ink);
  padding: 10px;
  font-size: 0.78rem;
  line-height: 1.28;
}

.install-link {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 8px;
  background: var(--amber);
  color: var(--ink);
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
  font-weight: 820;
  text-decoration: none;
}

.install-link.dark {
  background: #101010;
  color: #fff;
}

.install-note {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.32;
}

.install-note p {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 390px) {
  .current-pair {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 340px) {
  .hero-card {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .hero-artwork {
    width: 86px;
    height: 86px;
  }

  .composer-head {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
  }

  .source-badge {
    display: none;
  }
}
