:root {
  color-scheme: light;
  --page: oklch(0.952 0.04 351);
  --page-warm: oklch(0.977 0.03 30);
  --panel: oklch(0.992 0.011 350);
  --panel-soft: oklch(0.968 0.028 350);
  --field: oklch(0.998 0.008 350);
  --ink: oklch(0.235 0.045 318);
  --muted: oklch(0.49 0.04 316);
  --faint: oklch(0.68 0.034 318);
  --line: oklch(0.842 0.041 347);
  --line-strong: oklch(0.72 0.06 344);
  --pink: oklch(0.68 0.19 350);
  --pink-deep: oklch(0.52 0.18 350);
  --rose-ink: oklch(0.35 0.11 348);
  --spotify: oklch(0.68 0.19 151);
  --spotify-deep: oklch(0.47 0.14 151);
  --blue: oklch(0.54 0.13 251);
  --peach: oklch(0.86 0.09 48);
  --danger: oklch(0.52 0.19 26);
  --shadow: 0 24px 60px oklch(0.31 0.05 318 / 0.18);
  --radius: 8px;
  --fast-out: cubic-bezier(0.16, 1, 0.3, 1);
  --font-ui:
    "Nunito", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --font-display: "Lobster Two", ui-rounded, var(--font-ui);
  font-family: var(--font-ui);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, oklch(0.99 0.026 350 / 0.88), transparent 44%),
    repeating-linear-gradient(
      135deg,
      oklch(0.79 0.075 350 / 0.26) 0 1px,
      transparent 1px 22px
    ),
    linear-gradient(160deg, var(--page), var(--page-warm) 62%, oklch(0.94 0.04 326));
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

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

.shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 56px 22px;
}

.tool {
  width: calc(100vw - 44px);
  max-width: 760px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.masthead {
  display: flex;
  gap: 24px;
  align-items: start;
  justify-content: space-between;
  padding: 34px 34px 28px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, oklch(0.91 0.07 350), oklch(0.98 0.026 30));
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--rose-ink);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 12.5ch;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 4.12rem;
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: 0;
  text-shadow:
    0 3px 0 oklch(0.9 0.052 350 / 0.75),
    0 14px 30px oklch(0.42 0.1 330 / 0.12);
}

.bubbly-title {
  position: relative;
  transform-origin: left center;
  display: inline-block;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.bubbly-title {
  position: relative;
  transform-origin: left center;
  display: inline-block;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

/* simpler, original bubbly-title lines */
.bubbly-title .title-line {
  display: block;
  animation: title-bubble 5.6s var(--fast-out) infinite;
  will-change: transform;
  color: #ffffff;
  position: relative;
  z-index: 1;
  text-shadow: 0 6px 0 rgba(0,0,0,0.12), 0 18px 30px rgba(0,0,0,0.12);
  font-family: var(--font-ui);
  font-weight: 800;
}

.title-line:nth-child(2) {
  animation-delay: 760ms;
  margin-top: 4px;
}

/* title bubbles positioned to overlap the heading */
.title-bubbles {
  position: absolute;
  left: 0;
  top: -46px; /* lift bubbles up so they overlap the letters */
  width: 100%;
  height: 220px;
  pointer-events: none;
  overflow: visible;
  z-index: 2;
}

.title-bubbles .bubble {
  position: absolute;
  bottom: 6px;
  z-index: 3;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.98), rgba(245,230,255,0.85));
  border: 3px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  opacity: 1;
  box-shadow: 0 18px 36px rgba(0,0,0,0.12), inset 0 -10px 18px rgba(255,255,255,0.6);
  animation: bubble-rise 4.8s var(--fast-out) infinite, bubble-wobble 6s ease-in-out infinite;
  transform-origin: center bottom;
}

.title-bubbles .bubble:nth-child(1) { left: 4%; width: 32px; height: 32px; animation-delay: 0s; }
.title-bubbles .bubble:nth-child(2) { left: 18%; width: 42px; height: 42px; animation-delay: 0.4s; }
.title-bubbles .bubble:nth-child(3) { left: 34%; width: 26px; height: 26px; animation-delay: 0.9s; }
.title-bubbles .bubble:nth-child(4) { left: 50%; width: 48px; height: 48px; animation-delay: 1.5s; }
.title-bubbles .bubble:nth-child(5) { left: 66%; width: 30px; height: 30px; animation-delay: 2.1s; }
.title-bubbles .bubble:nth-child(6) { left: 80%; width: 38px; height: 38px; animation-delay: 2.8s; }
.title-bubbles .bubble:nth-child(7) { left: 92%; width: 24px; height: 24px; animation-delay: 3.2s; }

@keyframes bubble-rise {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  55% { transform: translateY(-110px) scale(1.05); opacity: 0.95; }
  100% { transform: translateY(-260px) scale(1.14); opacity: 0; }
}

@keyframes bubble-wobble {
  0% { transform: translateX(0) translateY(0) rotate(0deg); }
  50% { transform: translateX(10px) translateY(-60px) rotate(6deg); }
  100% { transform: translateX(-10px) translateY(-120px) rotate(-6deg); }
}

@media (max-width: 640px) {
  .bubbly-title .title-line { font-size: 4.2rem; }
  .title-bubbles { height: 160px; top: -24px; }
  .title-bubbles .bubble { bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .title-bubbles .bubble { animation: none !important; opacity: 0.95; transform: translateY(-20px); }
  .bubbly-title .title-line { animation: none !important; }
}

@media (max-width: 640px) {
  .bubbly-title .title-line { font-size: 3.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bubbly-title .title-line { animation: none !important; }
}

.route-chip {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 7px;
  align-items: center;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid oklch(0.68 0.1 350 / 0.35);
  border-radius: 999px;
  color: var(--rose-ink);
  background: oklch(0.995 0.01 350 / 0.82);
  font-size: 0.82rem;
  font-weight: 900;
}

.route-chip span:nth-child(2) {
  color: var(--faint);
  font-weight: 760;
}

.converter {
  display: grid;
  gap: 16px;
  padding: 28px 34px 0;
}

.route-switch {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.route-switch legend {
  padding: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 52px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(0.976 0.022 350);
}

.segmented-control label {
  min-width: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.segmented-control span {
  display: grid;
  min-height: 40px;
  padding: 0 10px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  text-align: center;
  transition:
    border-color 160ms var(--fast-out),
    box-shadow 160ms var(--fast-out),
    color 160ms var(--fast-out),
    background-color 160ms var(--fast-out);
}

.segmented-control input:checked + span {
  border-color: oklch(0.68 0.1 350 / 0.34);
  color: var(--rose-ink);
  background: var(--field);
  box-shadow: 0 8px 20px oklch(0.31 0.05 318 / 0.08);
}

.segmented-control input:focus-visible + span {
  outline: 3px solid oklch(0.71 0.14 350 / 0.36);
  outline-offset: 2px;
}

.field {
  display: grid;
  gap: 8px;
}

label,
.result-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-width: 0;
}

input,
select {
  min-width: 0;
  min-height: 52px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--field);
  font-weight: 800;
  outline: none;
  transition:
    border-color 160ms var(--fast-out),
    box-shadow 160ms var(--fast-out),
    background-color 160ms var(--fast-out);
}

#source-url {
  padding: 0 16px;
}

input:focus-visible,
select:focus-visible {
  border-color: var(--pink-deep);
  box-shadow: 0 0 0 4px oklch(0.72 0.14 350 / 0.22);
}

input::placeholder {
  color: var(--faint);
}

.action-row {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.country-field {
  display: grid;
  gap: 8px;
}

.select-wrap {
  position: relative;
  display: block;
}

.select-wrap::after {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--rose-ink);
  border-bottom: 2px solid var(--rose-ink);
  content: "";
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
}

#user-country {
  appearance: none;
  padding: 0 38px 0 14px;
  background: var(--field);
  cursor: pointer;
}

button,
.secondary-link,
.bookmarklet {
  min-width: 0;
  min-height: 52px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition:
    border-color 160ms var(--fast-out),
    box-shadow 160ms var(--fast-out),
    color 160ms var(--fast-out),
    background-color 160ms var(--fast-out),
    transform 160ms var(--fast-out);
}

button:active,
.secondary-link:active,
.bookmarklet:active {
  transform: translateY(1px);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid oklch(0.71 0.14 350 / 0.36);
  outline-offset: 3px;
}

.primary-button,
.success-button {
  color: oklch(0.996 0.006 350);
  font-weight: 900;
}

.primary-button {
  border: 1px solid color-mix(in oklch, var(--pink-deep), var(--ink) 18%);
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  box-shadow: 0 14px 30px oklch(0.58 0.17 350 / 0.24);
}

.primary-button:hover {
  box-shadow: 0 16px 36px oklch(0.58 0.17 350 / 0.32);
}

.success-button {
  border: 1px solid color-mix(in oklch, var(--spotify-deep), var(--ink) 16%);
  background: linear-gradient(135deg, var(--spotify), var(--spotify-deep));
  box-shadow: 0 12px 26px oklch(0.56 0.16 151 / 0.24);
}

.success-button:hover {
  box-shadow: 0 14px 32px oklch(0.56 0.16 151 / 0.3);
}

button:disabled {
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.58;
}

.primary-button:disabled {
  cursor: wait;
  filter: saturate(0.8);
  opacity: 0.72;
}

.secondary-button,
.secondary-link,
.bookmarklet {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--rose-ink);
  background: var(--field);
  font-weight: 900;
}

.secondary-button {
  padding: 0 18px;
}

.secondary-button:hover,
.secondary-link:hover,
.bookmarklet:hover {
  border-color: var(--pink-deep);
  color: var(--pink-deep);
  background: oklch(0.98 0.024 350);
}

.status {
  min-height: 24px;
  margin: 16px 34px 0;
  color: var(--muted);
  font-weight: 800;
}

.status[data-tone="error"] {
  color: var(--danger);
}

.status[data-tone="success"] {
  color: var(--spotify-deep);
}

.result {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin: 18px 34px 0;
  padding: 16px;
  border: 1px solid oklch(0.77 0.07 151);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, oklch(0.955 0.035 151), oklch(0.982 0.015 350));
}

.result[data-target="appleMusic"] {
  border-color: oklch(0.78 0.075 350);
  background:
    linear-gradient(90deg, oklch(0.975 0.031 350), oklch(0.99 0.014 30));
}

.result[hidden] {
  display: none;
}

.result.without-artwork {
  grid-template-columns: minmax(0, 1fr) auto;
}

.player-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: 12px 34px 0;
  padding: 14px 16px;
  border: 1px solid oklch(0.77 0.07 151 / 0.72);
  border-radius: var(--radius);
  background:
    linear-gradient(100deg, oklch(0.972 0.026 151), oklch(0.99 0.014 350));
}

.player-panel[hidden] {
  display: none;
}

.player-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.player-title,
.player-note {
  margin: 0;
}

.player-title {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.player-note {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.player-note[data-tone="error"] {
  color: var(--danger);
}

.player-note[data-tone="success"] {
  color: var(--spotify-deep);
}

.player-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.player-disconnect {
  padding: 0 4px;
}

.artwork {
  width: 86px;
  height: 86px;
  border-radius: 7px;
  object-fit: cover;
  background:
    linear-gradient(135deg, var(--pink), var(--peach) 50%, var(--spotify));
  box-shadow: 0 12px 26px oklch(0.31 0.05 318 / 0.18);
}

.track-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.result-label,
.track-title,
.track-artist {
  margin: 0;
}

.track-title {
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 900;
}

.track-artist {
  color: var(--muted);
  font-weight: 800;
}

.result-url {
  overflow: hidden;
  color: var(--spotify-deep);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result[data-target="appleMusic"] .result-url {
  color: var(--pink-deep);
}

.result-actions {
  display: flex;
  gap: 8px;
}

.compact,
.secondary-link {
  min-width: 76px;
  padding: 0 16px;
}

.utility-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 26px;
  padding: 18px 34px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  background: var(--panel-soft);
}

.bookmarklet-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.bookmarklet {
  min-height: 36px;
  padding: 0 12px;
  color: var(--rose-ink);
}

.text-button {
  min-height: 36px;
  padding: 0;
  border: 0;
  color: var(--pink-deep);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 900;
}

.text-button:hover {
  color: var(--blue);
}

.powered-by {
  color: var(--muted);
}

@media (max-width: 640px) {
  .shell {
    place-items: start center;
    padding: 18px;
  }

  .masthead,
  .converter,
  .utility-bar {
    padding-right: 20px;
    padding-left: 20px;
  }

  .tool {
    width: calc(100vw - 36px);
  }

  .masthead {
    display: grid;
    gap: 18px;
    padding-top: 24px;
    padding-bottom: 22px;
  }

  h1 {
    max-width: 11.5ch;
    font-size: 3.18rem;
  }

  .route-chip {
    justify-content: center;
    width: 100%;
  }

  .segmented-control,
  .url-row,
  .action-row,
  .result,
  .player-panel {
    grid-template-columns: 1fr;
  }

  .status,
  .result,
  .player-panel {
    margin-right: 20px;
    margin-left: 20px;
  }

  .result {
    align-items: start;
  }

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

  .result-actions {
    width: 100%;
  }

  .result-actions > * {
    flex: 1;
  }

  .player-actions {
    justify-content: stretch;
    width: 100%;
  }

  .player-actions > button:not(.player-disconnect) {
    flex: 1;
  }

  .utility-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@keyframes title-bubble {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  18% {
    transform: translateY(-3px) scale(1.018, 0.988);
  }

  34% {
    transform: translateY(1px) scale(0.992, 1.01);
  }

  48% {
    transform: translateY(-1px) scale(1.006);
  }
}
