/* Compact sound, score, and maker controls around the handset. */
.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; }

html[data-theme] .music-control {
  display: flex; align-items: center; gap: 12px; width: min(100%, 350px);
  margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--ui-line);
  color: var(--ui-ink);
}
html[data-theme] .music-mute {
  display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px;
  position: relative; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-surface); color: var(--ui-accent);
  box-shadow: 0 3px 12px rgba(0,0,0,.08); cursor: pointer;
  transition: background-color 180ms cubic-bezier(.2,0,0,1), border-color 180ms cubic-bezier(.2,0,0,1), scale 180ms cubic-bezier(.2,0,0,1);
}
html[data-theme] .music-mute:hover { border-color: var(--ui-accent); }
html[data-theme] .music-mute:active { scale: .96; }
.music-mute svg { grid-area: 1 / 1; width: 21px; height: 21px; transition: opacity 220ms cubic-bezier(.2,0,0,1), scale 220ms cubic-bezier(.2,0,0,1), filter 220ms cubic-bezier(.2,0,0,1); }
.music-mute .speaker-on { opacity: 1; scale: 1; filter: blur(0); }
.music-mute .speaker-off { opacity: 0; scale: .25; filter: blur(4px); }
.music-control[data-muted="true"] .speaker-on { opacity: 0; scale: .25; filter: blur(4px); }
.music-control[data-muted="true"] .speaker-off { opacity: 1; scale: 1; filter: blur(0); }
html[data-theme] #music-volume {
  appearance: none; -webkit-appearance: none; flex: 1 1 auto; min-width: 0; height: 44px;
  margin: 0; border: 0; background: transparent; cursor: pointer;
}
html[data-theme] #music-volume::-webkit-slider-runnable-track {
  height: 8px; border: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--ui-accent) 0 var(--range-fill,10%), var(--ui-line) var(--range-fill,10%) 100%);
}
html[data-theme] #music-volume::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 24px; height: 24px; margin-top: -8px;
  border: 2px solid var(--ui-accent); border-radius: 8px; background: var(--ui-bg);
  box-shadow: 0 2px 9px rgba(0,0,0,.2);
}
html[data-theme] #music-volume::-moz-range-track { height: 8px; border: 0; border-radius: 99px; background: var(--ui-line); }
html[data-theme] #music-volume::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--ui-accent); }
html[data-theme] #music-volume::-moz-range-thumb { width: 22px; height: 22px; border: 2px solid var(--ui-accent); border-radius: 8px; background: var(--ui-bg); box-shadow: 0 2px 9px rgba(0,0,0,.2); }
html[data-theme] #music-volume-value { flex: 0 0 38px; color: var(--ui-muted); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.music-control[data-muted="true"] #music-volume-value { opacity: .65; }

/* The supplied arcade carpet is the night default. Day mode is a flat pastel. */
html[data-theme="night"] body[data-surface="carpet"] { --ui-wash: rgba(8, 8, 18, .08); }
html[data-theme="night"] body[data-surface="carpet"] .desk-surface {
  filter: brightness(.94) saturate(.94); transform: none;
}
html[data-theme="day"] body { background: #f5ecdf; }
html[data-theme="day"] body[data-surface] .desk-surface {
  background-image: none; background-color: #f5ecdf;
  filter: none; transform: none;
}
html[data-theme="day"] .page-shell::before { background: transparent; }
html[data-theme="day"] #desk-light { display: none; }
.day-scene-note { display: none; }
html[data-theme="day"] .day-scene-note {
  display: block; margin: 10px 0 0; color: var(--ui-muted);
  font-size: 13px; line-height: 1.5;
}
html[data-theme="day"] .surface-options { display: none; }

/* The handset stays central; the score is a quiet, collapsible companion. */
html[data-theme] .score-panel {
  display: flex; flex-direction: column; align-self: center; justify-self: end;
  width: min(100%, 270px); max-width: 270px; max-height: none;
  padding: 19px; border: 1px solid var(--ui-line); border-radius: 17px;
  background: var(--ui-surface); color: var(--ui-ink);
  box-shadow: 0 12px 36px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  overflow: visible; animation: none;
  transition: padding 240ms cubic-bezier(.2,0,0,1), box-shadow 240ms cubic-bezier(.2,0,0,1);
}
html[data-theme="day"] .score-panel { box-shadow: 0 12px 36px rgba(21,41,29,.09), inset 0 1px 0 rgba(255,255,255,.45); }
html[data-theme] .score-panel-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; min-height: 40px; margin: -5px 0 4px; padding: 0;
  border: 0; background: transparent; color: var(--ui-muted);
  font-family: inherit; font-size: 11px; font-weight: 700; line-height: 1.2;
  letter-spacing: .12em; text-align: left; cursor: pointer;
}
.score-panel-chevron {
  width: 9px; height: 9px; margin-right: 5px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(225deg); transition: transform 220ms cubic-bezier(.2,0,0,1);
}
.score-panel[data-collapsed="true"] .score-panel-chevron { transform: rotate(45deg); }
html[data-theme] .score-value,
html[data-theme] .score-value.t-digit-group {
  display: inline-flex; width: fit-content; margin: 0;
  color: var(--ui-accent); font-family: inherit; font-size: clamp(58px, 5.2vw, 76px);
  font-weight: 570; line-height: 1.04; letter-spacing: -.075em;
  font-variant-numeric: tabular-nums;
  transition: font-size 240ms cubic-bezier(.2,0,0,1), color 200ms ease;
}
.is-celebrating .score-value { animation: score-breathe 500ms cubic-bezier(.2,0,0,1); }
@keyframes score-breathe { 50% { scale: 1.035; } }
.score-panel-content, .share-options {
  display: grid; grid-template-rows: 1fr; opacity: 1;
  transition: grid-template-rows 240ms cubic-bezier(.2,0,0,1), opacity 170ms ease;
}
.score-panel-content-inner, .share-options-inner { min-height: 0; overflow: hidden; }
.score-panel[data-collapsed="true"] .score-panel-content,
.score-panel[data-sharing="false"] .share-options { grid-template-rows: 0fr; opacity: 0; }
html[data-theme] .share-button,
html[data-theme] .share-card-button {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--ui-accent); border-radius: 10px;
  background: var(--ui-accent); color: var(--ui-accent-text);
  font-family: inherit; font-size: 13px; font-weight: 650; line-height: 1;
  text-align: left; cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, scale 180ms cubic-bezier(.2,0,0,1);
}
html[data-theme] .share-button { margin-top: 15px; }
html[data-theme] .share-button:hover,
html[data-theme] .share-card-button:hover { background: var(--ui-ink); color: var(--ui-bg); }
html[data-theme] .share-button:active,
html[data-theme] .share-card-button:active { scale: .96; }
html[data-theme] .share-card-button {
  margin-top: 12px; border-color: var(--ui-line); background: transparent;
  color: var(--ui-ink); font-weight: 600;
}
html[data-theme] .story-preview {
  display: flex; align-items: center; gap: 13px; margin-top: 14px;
  border: 1px solid var(--ui-line); border-radius: 12px; padding: 9px;
  background: var(--ui-bg);
}
html[data-theme] .story-preview img {
  display: block; flex: 0 0 54px; width: 54px; height: 96px;
  border-radius: 6px; object-fit: cover;
  outline: 1px solid rgba(255,255,255,.1);
}
html[data-theme="day"] .story-preview img { outline-color: rgba(0,0,0,.1); }
html[data-theme] .story-preview div { min-width: 0; }
html[data-theme] .story-preview strong { display: block; color: var(--ui-ink); font-size: 13px; font-weight: 650; }
html[data-theme] .story-preview span { display: block; margin-top: 5px; color: var(--ui-muted); font-size: 11px; line-height: 1.45; }
html[data-theme] #download-card { border-color: var(--ui-accent); background: var(--ui-accent); color: var(--ui-accent-text); }
html[data-theme] #download-card:hover { background: var(--ui-ink); color: var(--ui-bg); }
html[data-theme] #download-card { text-decoration: none; }
html[data-theme] #download-card[aria-disabled="true"] { cursor: progress; opacity: .65; }
html[data-theme] .share-card-secondary { margin-top: 7px; }
html[data-theme] .share-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
html[data-theme] .share-grid button,
html[data-theme] .share-grid a {
  grid-column: span 2;
  min-height: 42px; border: 1px solid var(--ui-line); border-radius: 8px;
  padding: 7px 3px; background: transparent; color: var(--ui-ink);
  font-size: 11px; font-weight: 600;
  transition: background-color 180ms ease, scale 180ms cubic-bezier(.2,0,0,1);
}
html[data-theme] .share-grid button:hover,
html[data-theme] .share-grid a:hover { background: var(--ui-bg); transform: none; }
html[data-theme] .share-grid button:active,
html[data-theme] .share-grid a:active { transform: none; scale: .96; }
html[data-theme] .share-grid > :nth-last-child(-n+2) { grid-column: span 3; }
html[data-theme] .score-panel[data-collapsed="true"] {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  padding: 11px 16px; border-radius: 13px;
}
html[data-theme] .score-panel[data-collapsed="true"] .score-panel-toggle { grid-column: 1; grid-row: 1; min-height: 42px; margin: 0; }
html[data-theme] .score-panel[data-collapsed="true"] .score-value,
html[data-theme] .score-panel[data-collapsed="true"] .score-value.t-digit-group {
  grid-column: 2; grid-row: 1; font-size: 29px; line-height: 1;
}
html[data-theme] .score-panel[data-collapsed="true"] .score-panel-content { grid-column: 1 / -1; }

@media (max-width: 1120px) {
  html[data-theme] .score-panel { grid-column: 1 / -1; justify-self: center; width: min(100%, 390px); max-width: 390px; margin-top: 16px; }
}
@media (max-width: 700px) {
  html[data-theme] .music-control { width: 100%; margin-top: 18px; }
  html[data-theme] .intro > .music-control,
  html[data-theme] .intro > .maker-open { grid-column: 1 / -1; }
  html[data-theme] .score-panel { width: min(100%, 430px); max-width: 430px; margin: 22px auto 0; }
}
@media (prefers-reduced-motion: reduce) {
  .music-mute svg, .music-mute, .score-panel, .score-value, .score-panel-content,
  .share-options, .score-panel-chevron, .share-button, .share-card-button { transition: none !important; }
  .is-celebrating .score-value { animation: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  html[data-theme] .score-panel { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--ui-bg); }
}

/* A quiet maker link sits with the volume control, without a footer rule. */
html[data-theme] .maker-open {
  display: inline-flex; align-items: center; width: fit-content;
  min-height: 42px; margin-top: 7px; padding: 0 2px;
  border: 0; background: transparent; color: #c2cec0;
  box-shadow: none; font-family: inherit; font-size: 12px; font-weight: 500;
  line-height: 1.2; text-decoration: none;
  transition: color 180ms ease, scale 180ms cubic-bezier(.2,0,0,1);
}
html[data-theme="day"] .maker-open { color: #68665e; }
html[data-theme] .maker-open span { color: inherit; transform: none; }
html[data-theme] .maker-open:hover { color: var(--ui-ink); }
html[data-theme] .maker-open:hover span { text-decoration: underline; text-underline-offset: 3px; transform: none; }
html[data-theme] .maker-open:active { scale: .96; }
@media (prefers-reduced-motion: reduce) {
  html[data-theme] .maker-open { transition: none !important; }
}

/* Quiet profile links, with generous tap targets and a clear reading order. */
html[data-theme] .maker-contact {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0;
  margin-top: 21px;
}
html[data-theme] .maker-contact a {
  display: inline-flex; align-items: center; justify-content: flex-start;
  width: fit-content; min-height: 44px; padding: 0;
  border: 0; border-radius: 0; background: transparent;
  color: var(--ui-ink); box-shadow: none; font-size: 14px; font-weight: 500;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
}
html[data-theme] .maker-contact a:hover {
  border: 0; background: transparent; color: var(--ui-accent);
}
