:root {
  color-scheme: dark;
  --ink: #0c0d18;
  --surface: rgba(24, 26, 44, 0.74);
  --surface-solid: #181a2c;
  --raised: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f6f2ea;
  --muted: #b4b6d0;
  --tangerine: #ff7a35;
  --pink: #ff4f8b;
  --violet: #8b5cff;
  --aqua: #2ee6c5;
  --sun: #ffd23f;
  --sky: #3db2ff;
  --danger: #ff5d6c;
  --radius: 22px;
  --spring: cubic-bezier(0.2, 1.5, 0.4, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: ui-rounded, "Nunito", "SF Pro Rounded", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Some engines run transitions from default styles on first paint. */
.preload *, .preload *::before, .preload *::after { transition: none !important; }

html { background: var(--ink); }

/* The page colour is on html only: a body background would paint over the backdrop's glow. */
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 500 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 120px;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
code { font-family: ui-monospace, "SF Mono", monospace; font-size: 0.9em; color: var(--sun); }

.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
  animation: drift 26s ease-in-out infinite alternate;
}
.blob.tangerine { background: var(--tangerine); top: -18vmax; left: -12vmax; }
.blob.violet { background: var(--violet); top: 10vmax; right: -20vmax; animation-delay: -8s; }
.blob.aqua { background: var(--aqua); bottom: -26vmax; left: 18vmax; opacity: 0.18; animation-delay: -15s; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(6vmax, 4vmax) scale(1.12); }
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 16px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.wordmark {
  font-weight: 900;
  font-size: 26px;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, var(--tangerine), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tag {
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.logo { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.logo i {
  width: 5px;
  border-radius: 3px;
  background: linear-gradient(var(--sun), var(--tangerine));
  animation: eq 1.1s ease-in-out infinite;
}
.logo i:nth-child(1) { height: 40%; animation-delay: -0.3s; }
.logo i:nth-child(2) { height: 90%; animation-delay: -0.7s; }
.logo i:nth-child(3) { height: 60%; animation-delay: -0.1s; }
.logo i:nth-child(4) { height: 75%; animation-delay: -0.5s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.45); } 50% { transform: scaleY(1); } }
.logo i { transform-origin: bottom; }

.top-actions { display: flex; align-items: center; gap: 8px; }

.page { max-width: 980px; margin: 0 auto; padding: 0 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.hero { padding: 26px 26px 20px; }
.hero-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tangerine);
}
.game-badge {
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  font-variant-numeric: tabular-nums;
}
.title-input {
  width: 100%;
  margin: 6px 0 18px;
  padding: 4px 0 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: clamp(30px, 5.6vw, 52px);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.1;
  outline: none;
  transition: border-color 0.25s var(--ease);
}
.title-input::placeholder { color: rgba(246, 242, 234, 0.22); }
.title-input:focus { border-bottom-color: rgba(255, 122, 53, 0.55); }
.title-input.invalid { border-bottom-color: var(--danger); }

.settings { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.segmented {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  max-width: 100%;
  overflow-x: auto;
}
.segmented button {
  position: relative;
  z-index: 1;
  border: 0;
  background: none;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 15px;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.25s var(--ease);
}
.segmented button[aria-checked="true"] { color: #1a0f08; }
.segmented .indicator {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(100deg, var(--sun), var(--tangerine));
  box-shadow: 0 6px 20px rgba(255, 122, 53, 0.35);
  transition: transform 0.45s var(--spring), width 0.45s var(--spring);
}

.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px;
  transition: background 0.25s var(--ease);
}
.switch-thumb {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.4s var(--spring);
}
.switch input:checked + .switch-track { background: var(--aqua); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--aqua); outline-offset: 3px; }
.mode-hint { margin: 14px 0 0; color: var(--muted); min-height: 1.45em; }
.rounds { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rounds-label { font-weight: 800; margin-right: 6px; }
.rounds button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 14px;
  color: var(--muted);
  transition: background 0.2s, color 0.2s, transform 0.3s var(--spring);
}
.rounds button:active { transform: scale(0.9); }
.rounds button[aria-checked="true"] { background: var(--aqua); border-color: var(--aqua); color: #06261f; }
.rounds button[hidden] { display: none; }

.songs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.songs-head h2 { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.songs-actions { display: flex; gap: 8px; transition: opacity 0.25s var(--ease), visibility 0.25s; }
/* The empty card has the same two buttons, bigger. */
.songs:has(> #empty:not([hidden])) .songs-actions { opacity: 0; visibility: hidden; }
.pill {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--line);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.pill.bump { animation: bump 0.45s var(--spring); }
@keyframes bump { 40% { transform: scale(1.35); } }

.song-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }

/* A song reads like a playlist row; its fields look like fields only when empty, hovered or edited.
   Hundreds of blurred cards scroll badly, so rows are near-opaque instead of glass. */
.song {
  display: grid;
  grid-template-columns: 18px 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px 10px 8px;
  border-radius: 18px;
  background: rgba(24, 26, 44, 0.86);
  border: 1px solid var(--line);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.song:focus-within { border-color: rgba(255, 122, 53, 0.32); background: rgba(28, 30, 50, 0.92); }
.song.entering { animation: enter 0.55s var(--spring) both; }
.song.leaving { animation: leave 0.28s var(--ease) both; }
.song.dragging { opacity: 0.45; }
.song.drop-target { border-color: var(--tangerine); }
.song.has-problem { border-color: rgba(255, 93, 108, 0.55); }
@keyframes enter { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes leave { to { opacity: 0; transform: translateX(30px) scale(0.96); } }

.song-grip { display: grid; gap: 3px; align-content: center; height: 64px; cursor: grab; opacity: 0.35; }
.song-grip i { display: block; height: 3px; border-radius: 2px; background: var(--text); }

.cover {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--c1, var(--tangerine)), var(--c2, var(--pink)));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: fade 0.5s var(--ease); }
.cover .number { font-weight: 900; font-size: 22px; color: rgba(255, 255, 255, 0.92); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
@keyframes fade { from { opacity: 0; transform: scale(1.08); } }

.fields { display: grid; gap: 2px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1.4fr 1fr 76px; gap: 6px; }
.link-row { position: relative; }
.input {
  width: 100%;
  min-width: 0;
  padding: 8px 11px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.input:placeholder-shown { border-color: var(--line); background: rgba(0, 0, 0, 0.22); }
.input::placeholder { color: rgba(155, 157, 186, 0.7); }
.input:focus { border-color: rgba(255, 122, 53, 0.6); box-shadow: 0 0 0 4px rgba(255, 122, 53, 0.14); background: rgba(0, 0, 0, 0.32); }
.input.invalid { border-color: rgba(255, 93, 108, 0.7); }
.input.flash { animation: flash 0.9s var(--ease); }
@keyframes flash { 0% { background: rgba(46, 230, 197, 0.28); } }
.song-title { font-weight: 800; font-size: 17px; }
.song-artist { color: #d6d7ea; }
.song-year { text-align: center; font-variant-numeric: tabular-nums; font-weight: 800; background: rgba(255, 255, 255, 0.06); }
.song-link {
  padding-block: 5px;
  padding-right: 120px;
  font: 500 13px/1.45 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
}
.song-link:focus { color: var(--text); }

.link-chip {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.link-chip:empty { display: none; }
.link-chip.spotify { background: rgba(30, 215, 96, 0.16); color: #4be38a; }
.link-chip.audio { background: rgba(61, 178, 255, 0.16); color: #79c9ff; }
.link-chip.bad { background: rgba(255, 93, 108, 0.16); color: #ff8a95; }
.link-chip.pop { animation: chip 0.5s var(--spring); }
@keyframes chip { 0% { transform: translateY(-50%) scale(0.5); opacity: 0; } }

.song-problem { margin: 0; font-size: 13px; font-weight: 700; color: #ff8a95; }

.song-side { display: grid; gap: 8px; justify-items: end; }
.mode-toggle {
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 0.3s var(--spring), background 0.2s;
}
.mode-toggle:active { transform: scale(0.92); }
.song-buttons { display: flex; gap: 4px; }
.mini {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
  transition: background 0.2s, color 0.2s, transform 0.25s var(--spring);
}
.mini:active { transform: scale(0.88); }

.add-more {
  width: 100%;
  margin-top: 12px;
  padding: 15px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: none;
  color: var(--muted);
  font-weight: 800;
  transition: border-color 0.2s, color 0.2s, transform 0.3s var(--spring);
}
.add-more:active { transform: scale(0.98); }

.empty { padding: 36px 26px; text-align: center; display: grid; justify-items: center; gap: 4px; }
.empty h3 { margin: 14px 0 0; font-size: 22px; font-weight: 900; }
.empty p { margin: 4px 0 18px; color: var(--muted); max-width: 520px; }
.empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.vinyl {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #1b1c2b 0 2px, #26283b 2px 4px);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: spin 6s linear infinite;
}
.vinyl span { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--tangerine), var(--pink)); box-shadow: inset 0 0 0 11px transparent; position: relative; }
.vinyl span::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.primary, .ghost, .icon-button {
  white-space: nowrap;
  border-radius: 999px;
  font-weight: 800;
  transition: transform 0.3s var(--spring), box-shadow 0.25s var(--ease), background 0.2s, opacity 0.2s;
}
.primary {
  border: 0;
  padding: 13px 24px;
  color: #1d0f07;
  background: linear-gradient(100deg, var(--sun), var(--tangerine) 55%, var(--pink));
  background-size: 160% 100%;
  box-shadow: 0 10px 28px rgba(255, 122, 53, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.primary:active { transform: scale(0.95); }
.primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.primary.small { padding: 9px 16px; }
.ghost {
  padding: 9px 15px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}
.ghost:active { transform: scale(0.95); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.03); }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-button svg path:first-child { fill: currentColor; }
.icon-button.muted .wave { opacity: 0; }
.count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--tangerine);
  color: #1d0f07;
  font-size: 12px;
}
:focus-visible { outline: 2px solid var(--tangerine); outline-offset: 2px; }
.input:focus-visible, .title-input:focus-visible { outline: none; }

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  pointer-events: none;
  transition: transform 0.4s var(--ease), opacity 0.25s var(--ease);
}
/* The keyboard covers the bottom of the screen; the dock comes back when it closes. */
.keyboard .dock { transform: translateY(calc(100% + 24px)); opacity: 0; }
.keyboard .dock-inner { pointer-events: none; }
.dock-inner {
  pointer-events: auto;
  max-width: 948px;  /* the page's 980px less its padding, so the dock lines up with the cards */
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 12px 12px 22px;
  border-radius: 999px;
  background: rgba(20, 22, 38, 0.84);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.status { font-weight: 700; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status strong { color: var(--text); }
.status .ok { color: var(--aqua); }
.status .warn { color: var(--sun); }

.sheet {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  overflow: auto;
}
.sheet[open] { animation: sheet 0.5s var(--spring); }
.sheet::backdrop { background: rgba(5, 6, 14, 0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
@keyframes sheet { from { opacity: 0; transform: translateY(24px) scale(0.96); } }
.sheet h2 { margin: 4px 0 8px; font-size: 26px; font-weight: 900; letter-spacing: -0.015em; }
.sheet:focus-visible { outline: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.close {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin-right: -6px;
  border: 0;
  border-radius: 50%;
  background: var(--raised);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}
.muted { color: var(--muted); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.sheet textarea {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  font: 600 14px/1.5 ui-monospace, "SF Mono", monospace;
  resize: vertical;
  outline: none;
}
.sheet textarea:focus { border-color: rgba(255, 122, 53, 0.6); }
.paste-preview { min-height: 1.45em; margin: 10px 0 0; font-weight: 700; color: var(--muted); }
.paste-preview .ok { color: var(--aqua); }

.saved { text-align: center; overflow: hidden; }
.saved .sheet-actions { justify-content: center; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.digits { display: flex; justify-content: center; gap: 8px; margin: 22px 0 18px; }
.digit {
  width: 58px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 44px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(160deg, rgba(255, 210, 63, 0.18), rgba(255, 79, 139, 0.14));
  border: 1px solid rgba(255, 210, 63, 0.35);
  animation: digit 0.7s var(--spring) both;
}
.digit.gap { width: 10px; background: none; border: 0; }
@keyframes digit { from { opacity: 0; transform: translateY(-26px) rotateX(80deg); } }

/* The title and tabs stay put while a long list of games scrolls. */
#mineDialog[open] { display: flex; flex-direction: column; overflow: hidden; }
#mineDialog [data-panel] { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -8px; padding: 0 8px 4px; }
.mine-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.mine-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--raised);
  border: 1px solid var(--line);
}
.mine-item h3 { margin: 0; font-size: 17px; font-weight: 900; }
.mine-item p { margin: 0; color: var(--muted); font-size: 14px; }
.mine-item .mine-actions { grid-row: span 2; display: flex; gap: 6px; }
.mine-empty { color: var(--muted); padding: 10px 0; }

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 6px 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}
.tabs button {
  padding: 8px 15px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-weight: 800;
  transition: background 0.2s, color 0.2s;
}
.tabs button[aria-selected="true"] { background: rgba(255, 255, 255, 0.1); color: var(--text); }
[data-panel] .muted { margin: 0; }

/* The buttons sit under the words, so a title and tagline get the card's width. */
.starter-item { grid-template-columns: auto 1fr; align-items: start; gap: 10px 14px; animation: rise 0.5s var(--spring) both; animation-delay: var(--delay); }
.starter-item .mine-actions { grid-row: auto; grid-column: 2; }
.starter-item .tagline { color: var(--text); opacity: 0.86; margin: 2px 0 4px; }
.starter-tile {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 26px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.starter-link {
  margin-top: 18px;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 700;
}
.starter-link strong { color: var(--text); text-decoration: underline; text-decoration-color: var(--tangerine); text-underline-offset: 3px; }

/* Touch screens keep hover styles after a tap, so only real pointers get them. */
@media (hover: hover) {
  .primary:hover { transform: translateY(-1px); background-position: 100% 0; box-shadow: 0 14px 34px rgba(255, 79, 139, 0.36); }
  .primary:disabled:hover { transform: none; }
  .ghost:hover { background: rgba(255, 255, 255, 0.08); }
  .mini:hover { background: var(--raised); color: var(--text); }
  .mini.remove:hover { color: var(--danger); background: rgba(255, 93, 108, 0.12); }
  .input:hover:not(:focus):not(.invalid) { background: rgba(255, 255, 255, 0.05); }
  .song-year:hover:not(:focus) { background: rgba(255, 255, 255, 0.09); }
  /* A row's handle and buttons show on the row the pointer or keyboard is on. */
  .song-grip, .song-buttons { opacity: 0; transition: opacity 0.2s var(--ease); }
  .song:hover .song-grip { opacity: 0.55; }
  .song:hover .song-buttons, .song:focus-within .song-buttons { opacity: 1; }
  .add-more:hover { border-color: var(--tangerine); color: var(--text); }
  .close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
  .starter-link:hover strong { color: var(--tangerine); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 104px;
  transform: translate(-50%, 20px);
  padding: 11px 18px;
  border-radius: 999px;
  background: #f6f2ea;
  color: #15131f;
  font-weight: 800;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.45s var(--spring);
  width: max-content;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.keyboard .toast { bottom: calc(var(--keyboard, 0px) + 16px); }
.toast.error { background: var(--danger); color: #fff; }

.narrow { display: none; }

@media (max-width: 720px) {
  .hero { padding: 20px 18px 16px; }
  .top { padding-top: 16px; }
  .tag { display: none; }
  /* Phones: cover beside the title, then artist and year, the link, and the row's buttons. */
  .song {
    grid-template-columns: 44px minmax(0, 1fr) 76px;
    grid-template-areas: "cover title title" "artist artist year" "link link link" "side side side";
    gap: 2px 8px;
    padding: 10px 10px 6px;
    background: rgba(24, 26, 44, 0.94);
  }
  .song.has-problem {
    grid-template-areas: "cover title title" "artist artist year" "link link link" "problem problem problem" "side side side";
  }
  .fields, .field-row { display: contents; }
  .song-grip { display: none; }
  .cover { grid-area: cover; width: 44px; height: 44px; align-self: center; border-radius: 12px; }
  .cover .number { font-size: 18px; }
  .song-title { grid-area: title; }
  .song-artist { grid-area: artist; }
  .song-year { grid-area: year; }
  .link-row { grid-area: link; }
  .song-problem { grid-area: problem; padding: 0 4px; }
  /* 16px keeps iOS from zooming in on focus; at that size the rounded face fits more of the link. */
  .song-link { font-family: var(--font); font-size: 16px; padding-right: 108px; }
  .song-artist, .song-year, .song-link { margin-top: 4px; }
  .link-chip { right: 7px; padding: 4px 8px; font-size: 11.5px; }
  .song-side { grid-area: side; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .song-buttons { margin-left: auto; gap: 2px; }
  .mini { width: 40px; height: 36px; }
  .mode-toggle { padding: 8px 13px; }
  .dock-inner { padding-left: 18px; }
  .sheet textarea { font-size: 16px; }
  .digit { width: 44px; height: 60px; font-size: 34px; }
}

/* Phones: sheets rise from the bottom edge and stay above the keyboard. */
@media (max-width: 600px) {
  .sheet {
    width: 100%;
    max-width: none;
    margin: auto 0 var(--keyboard, 0px);
    max-height: calc(var(--visible-height, 100vh) - 16px);
    padding: 22px 18px calc(20px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 26px 26px 0 0;
  }
  .sheet[open] { animation: sheet-up 0.45s var(--ease); }
  .sheet textarea { height: clamp(88px, calc(var(--visible-height, 100vh) * 0.3), 200px); resize: none; }
  .sheet-actions { margin-top: 18px; }
  .sheet-actions > button { flex: 1 1 auto; }
  .saved .sheet-actions > #shareButton { flex-basis: 100%; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

@media (max-width: 480px) {
  .wide { display: none; }
  .narrow { display: inline; }
  .wordmark { font-size: 22px; }
  .logo { height: 22px; }
  .top-actions { gap: 6px; }
  .top-actions .ghost { padding: 8px 12px; font-size: 14px; }
  .icon-button { width: 36px; height: 36px; }
  /* Four round types fit side by side with the emoji above each name. */
  .segmented { display: flex; width: 100%; border-radius: 18px; }
  .segmented button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 4px 6px; border-radius: 14px; font-size: 13px; line-height: 1.25; }
  .segmented button > [aria-hidden] { font-size: 19px; }
  .segmented .indicator { border-radius: 14px; }
  .settings { gap: 14px; }
  /* The label above, the choices sharing one row below it. */
  .rounds { display: flex; width: 100%; gap: 6px; }
  .rounds-label { flex: 1 0 100%; margin: 0 0 2px; }
  .rounds button { flex: 1 1 0; max-width: 76px; padding-inline: 0; }
  .songs-head h2 { font-size: 21px; }
  .songs-actions .ghost, .songs-actions .primary.small { padding: 8px 14px; font-size: 14px; }
  .dock-inner { padding: 8px 8px 8px 16px; gap: 10px; border-radius: 26px; }
  .dock .primary { padding: 11px 18px; }
  /* Two short lines read better than one cut off. */
  .status { font-size: 13.5px; line-height: 1.3; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .digits { gap: 5px; }
  .digit { width: min(40px, calc((100vw - 80px) / 7)); height: 56px; font-size: 30px; border-radius: 12px; }
  .starter-item { grid-template-columns: auto 1fr; align-items: start; }
  .starter-item .mine-actions { grid-column: 1 / -1; }
  .starter-item .mine-actions .primary { flex: 1; }
  .starter-tile { width: 44px; height: 44px; font-size: 22px; border-radius: 14px; }
}

@media (max-width: 359px) {
  .wordmark { display: none; }
  .hero { padding: 18px 14px 14px; }
  .title-input { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
