:root {
  color-scheme: dark;
  font: 16px/1.5 Inter, "Helvetica Neue", Arial, sans-serif;
  background: #131a22;
  color: #f7f8fa;
  --muted: #b2bac5;
  --accent: #62c5ff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header, main {
  max-width: 64rem;
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 3rem);
}
header, .brand, #tesla-account {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .65rem;
}
header {
  padding-block: 1rem;
  justify-content: space-between;
  border-bottom: 1px solid #384450;
}
.brand { gap: .35em; font-size: 1.25rem; font-weight: 750; letter-spacing: -.045em; }
.product, .product-name { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.product img { width: clamp(2.5rem, 5vw, 3.5rem); height: auto; }
.product h1 span { color: var(--accent); }
.plan-label {
  margin-inline-start: .25rem;
  padding: .2em .65em;
  border: 1px solid #51606e;
  border-radius: 1em;
  background: #27313c;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .025em;
  white-space: nowrap;
}
#tesla-account, #follow-status, .intro, #vehicle-choice { color: var(--muted); }
#tesla-account { font-size: .875rem; gap: .4rem; }
main { padding-block: clamp(1.4rem, 3vw, 2.5rem); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; letter-spacing: -.045em; }
.intro { order: 1; margin-top: .65rem; font-size: .875rem; }
button, select {
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid #546170;
  background: #252f3a;
  color: inherit;
  padding: .5rem .9rem;
}
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #e4ebf2; outline-offset: 2px; }
#check-song { border-color: #637180; }
#vehicle-choice { display: block; margin: .5rem 0; }
#live-song:not(:empty), #follow-status:not(:empty) { margin-top: .75rem; }
.track { margin-top: clamp(1rem, 3vw, 2rem); }
#follow-track { font-size: clamp(1.15rem, 2.4vw, 1.8rem); line-height: 1.2; }
#live-lines, #live-song, #follow-track { overflow-wrap: anywhere; }
#live-lines:not(:empty) {
  margin-top: 1rem;
  padding: clamp(1rem, 2.5vw, 2rem);
  background: #1c2530;
  border-radius: 12px;
  white-space: pre-line;
  font-size: clamp(1.2rem, 2.4vw, 1.8rem);
  color: var(--muted);
}
#live-lines p + p { margin-top: .4rem; }
#live-lines [aria-current="true"] { color: var(--accent); font-weight: 700; font-size: clamp(2.1rem, 4.2vw, 3.2rem); line-height: 1.2; }

.recording { display: flex; align-items: center; gap: 1rem; }
.recording > div { min-width: 0; }
#album-cover { width: clamp(4rem, 11vw, 6rem); aspect-ratio: 1; object-fit: contain; border-radius: 5px; }
#catalog-status { font-size: .875rem; }
#release-info, #catalog-status, #about-song { color: var(--muted); overflow-wrap: anywhere; }
.track a { color: inherit; font-size: .875rem; }
#about-song { margin-top: 1rem; }
#about-song h3 { font-size: 1rem; margin: 0 0 .25rem; }

/* In a narrow window keep the current lyric ahead of the optional liner notes. */
.track { display: flex; flex-direction: column; }
.track-details { display: contents; }
#about-song { order: 1; }

@media (min-width: 48rem) {
  header, main { max-width: 100rem; padding-inline: clamp(1.5rem, 3.5vw, 4rem); }
  header { padding-block: .65rem; }
  main { padding-top: 1rem; }
  h1 { font-size: clamp(1.7rem, 2.8vw, 2.5rem); }
  .track {
    display: grid;
    grid-template-columns: minmax(13rem, .8fr) minmax(0, 2fr);
    gap: clamp(1.25rem, 3vw, 3rem);
    align-items: start;
    margin-top: 1.25rem;
  }
  .track-details { display: block; min-width: 0; }
  .recording { display: block; }
  #album-cover { width: clamp(8rem, 15vw, 13rem); margin-bottom: .65rem; }
  #follow-track { font-size: clamp(1.25rem, 2vw, 1.75rem); }
  #about-song:not([hidden]) { border-top: 1px solid #384450; padding-top: .75rem; }
  #live-lines:not(:empty) { margin-top: 0; padding: clamp(1.15rem, 2.5vw, 2.5rem); }
}

#artist-details { order: 2; margin-top: 1rem; }
#artist-details summary { cursor: pointer; font-weight: 650; padding-block: .65rem; }
#artist-details p { margin: .45rem 0; }
#artist-details figure { margin: .8rem 0; }
#artist-details img { display: block; width: min(100%, 20rem); height: auto; border-radius: 5px; }
#artist-details figcaption, #detail-status { font-size: .875rem; color: var(--muted); }

.lyric-countdown {
  display: grid;
  gap: .35rem;
  padding-block: .45rem .65rem;
  color: var(--muted);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
#lyric-progress { width: min(100%, 20rem); height: .55rem; accent-color: #afbfcd; }

main.signin-page { display: block; max-width: 32rem; padding: clamp(1.5rem, 5vh, 3rem) 1.25rem; }
.signin-page h2 { margin: 1.5rem 0 1rem; font-size: 1.35rem; }
.signin-page form { display: grid; gap: .45rem; }
.signin-page input:not([type="checkbox"]) {
  width: 100%; min-height: 3.3rem; padding: .6rem .85rem; margin-bottom: .6rem;
  font: inherit; font-size: 1.15rem; color: inherit; background: #1c2530;
  border: 1px solid #637180; border-radius: .5rem;
}
.toggle-password { min-height: 2.75rem; display: flex; align-items: center; gap: .6rem; }
.toggle-password input { width: 1.2rem; height: 1.2rem; }
.signin-page button { min-height: 3.4rem; font-size: 1.15rem; background: var(--accent); color: #131a22; }
.signin-page a { display: inline-block; padding-block: 1rem; color: var(--muted); }
#signin-error { color: #ffd3bd; }

.game-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.playbar, #play-tools, .mode-switch { display: flex; align-items: center; }
.playbar { justify-content: space-between; flex-wrap: wrap; gap: .25rem .5rem; }
.play-identity:has(.brand) { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: .4rem; }
.play-identity .brand { grid-area: 1 / 2; align-self: end; flex-wrap: nowrap; gap: .25rem; font-size: .875rem; line-height: 1.1; letter-spacing: -.025em; }
.play-identity .brand svg { flex: none; width: .8rem; height: 1.35rem; }
.play-identity .brand + .product { display: contents; }
.play-identity .brand + .product img { grid-area: 1 / 1 / 3; width: 3.5rem; }
.play-identity .product-name { grid-area: 2 / 2; align-self: start; gap: .35rem; }
main:has(#play-tools:not([hidden])) { padding-top: .5rem; }
#play-tools { gap: .5rem; }
.mode-switch { background: #1c2530; border-radius: 8px; padding: 2px; }
.mode-switch button { border: 0; background: transparent; padding-inline: .8rem; }
.song-check { display: flex; align-items: center; gap: .35rem; }
#check-hint { color: var(--muted); font-size: .8rem; }
#check-hint:empty { display: none; }
.check-icon { display: none; }
#play-menu { position: relative; }
#play-menu > summary { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; cursor: pointer; list-style: none; }
#play-menu > summary::-webkit-details-marker { display: none; }
#play-menu[open] > summary, #play-menu > summary:hover { background: #27313c; }
.play-menu-body { position: absolute; z-index: 2; right: 0; top: 100%; width: min(18rem, calc(100vw - 2rem)); padding: .8rem; border: 1px solid #546170; border-radius: 8px; background: #1c2530; box-shadow: 0 8px 20px #0006; }
.lyric-timing { display: grid; gap: .25rem; }
.play-menu-body > * + * { margin-top: .5rem; }
.play-menu-body #tesla-account { border-top: 1px solid #384450; padding-top: .6rem; }
.play-menu-body form { margin-left: auto; }
@media (max-width: 47.99rem) {
  .playbar:has(#play-tools:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .125rem; }
  .play-identity:has(.brand) { column-gap: .25rem; }
  .play-identity .brand { font-size: .75rem; }
  .play-identity .brand + .product img { width: 2.75rem; }
  .play-identity .product-name { gap: .125rem; }
  main:has(#play-tools:not([hidden])) { padding-inline: .65rem; }
  .playbar:has(#play-tools:not([hidden])) h1 { font-size: clamp(1.2rem, 5vw, 1.75rem); }
  .playbar:has(#play-tools:not([hidden])) .plan-label { justify-self: start; margin: 0; padding: 0 .35em; font-size: .7rem; }
  #play-tools { gap: .125rem; margin-inline-start: auto; }
  .mode-switch button { min-width: 44px; padding-inline: .3rem; }
  .song-check { flex-direction: column-reverse; gap: 0; width: 44px; }
  #check-hint { text-align: center; font-size: .7rem; line-height: 1.1; }
  #check-song { width: 44px; padding: 0; }
  .check-icon { display: inline; font-size: 1.5rem; }
  .check-label { display: none; }
}
@media (max-width: 23rem) {
  #play-tools { display: grid; grid-template-columns: auto auto; justify-items: center; gap: 0; }
  .mode-switch { grid-column: 1 / -1; }
  .mode-switch button { padding-inline: .4rem; }
}
.mode-switch [aria-pressed="true"], #game button[aria-pressed="true"] {
  background: var(--accent); color: #111c26; border-color: var(--accent);
}
#game { margin-block: .5rem; }
.game-toolbar { justify-content: space-between; }
#game-settings { background: #1c2530; border: 1px solid #384450; border-radius: 12px; padding: clamp(.75rem, 2.5vw, 1.6rem); min-width: 0; }
#game h3 { margin: 0 0 .5rem; }
#round-heading { font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.15; overflow-wrap: anywhere; }
#round-detail { color: var(--accent); font-variant-numeric: tabular-nums; }
#round-number, #score-hint, #game small { color: var(--muted); }
#game-settings { margin-top: .65rem; }
.round-summary { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.round-summary > div { min-width: 0; }
#reveal { flex: none; }
#score-panel { min-width: 0; border-block-start: 1px solid #384450; }
#score-panel > summary { cursor: pointer; padding-block: .6rem; min-height: 44px; font-weight: 650; }
#score-totals { margin-inline-start: .5em; font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
.round-layout { display: grid; align-items: start; gap: .4rem 1.25rem; }
.round-layout .game-lyrics { min-width: 0; margin: 0; }
.game-lyrics #live-lines:not(:empty) { margin-top: .25rem; }
#score-hint { font-size: .875rem; }
#scores button { display: inline-flex; align-items: center; justify-content: center; gap: .3em; font-variant-numeric: tabular-nums; }
#scores button span { opacity: .8; font-size: .85em; }
#scores button:disabled span { visibility: hidden; }
#game table { width: 100%; border-collapse: collapse; table-layout: fixed; }
#game th, #game td { text-align: center; padding: .3rem .1rem; overflow-wrap: anywhere; }
#game th:first-child { text-align: start; width: 32%; }
#game td button { width: 100%; padding: .3rem; }
#game tbody tr { border-top: 1px solid #384450; }
#scores td:last-child { font-weight: bold; color: var(--accent); }
#game-history summary { cursor: pointer; padding-block: .75rem; }
#past-rounds > button { display: block; margin: .4rem 0; }
#game-settings { display: grid; gap: .8rem; }
#game-settings fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
#player-inputs { display: flex; flex-wrap: wrap; gap: .5rem; }
#player-inputs input { min-width: 0; width: 9rem; font: inherit; padding: .55rem; color: inherit; background: #131a22; border: 1px solid #637180; border-radius: .4rem; }
#game-settings label { display: flex; align-items: center; gap: .65rem; min-height: 44px; }
.game-lyrics { display: block; }
.game-lyrics .track-details { display: contents; }
.game-lyrics .track-details > :not(#follow-status) { display: none; }
.game-lyrics #follow-status { margin: 0; font-size: .875rem; }
@media (min-width: 44rem) {
  .round-layout { grid-template-columns: minmax(0, 1fr) auto; }
  .round-summary { grid-area: 1 / 1; }
  #score-panel { grid-area: 1 / 2; border: 0; }
  .game-lyrics { grid-area: 2 / 1 / auto / -1; }
  .round-layout:has(#score-panel[open]) { grid-template-columns: minmax(0, 1fr) minmax(21rem, .9fr); }
  #score-panel[open] { grid-row: 1 / 3; }
  .round-layout:has(#score-panel[open]) .game-lyrics { grid-column: 1; }
  #score-totals { display: block; margin-inline-start: 1rem; }
  #score-panel { max-width: 25rem; }
}

#play-options { margin: 1rem 0; }
#play-options h2 { margin-bottom: .5rem; }
#tesla-guide { color: var(--muted); max-width: 42rem; }
#tesla-guide summary { padding: .6rem 0; cursor: pointer; }
#tesla-guide p { margin: .35rem 0; }
