:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #fbf5e8;
  background: #14131b;
  --paper: #f9e8c1;
  --muted: #c4bccc;
}
* { box-sizing: border-box; }
body { margin: 0; }
main {
  max-width: 860px;
  margin: auto;
  padding: max(28px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.hero { display: flex; align-items: center; gap: clamp(14px, 4vw, 35px); margin: 8px 0 24px; }
.hero h1 {
  color: var(--paper);
  font-weight: 950;
  line-height: .94;
  font-size: clamp(2.25rem, 9vw, 5.3rem);
  letter-spacing: -.075em;
  margin: 0 0 10px;
}
.hero p { margin: 0; color: var(--muted); font-size: 1rem; }
.record {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: clamp(49px, 14vw, 112px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #675b68;
  background: repeating-radial-gradient(circle, #251f2b 0 3px, #38303f 4px 5px);
  box-shadow: 4px 4px #09080e;
}
.record i { width: 38%; aspect-ratio: 1; border: 2px solid #18151e; border-radius: 50%;
  background: radial-gradient(circle, #18151e 0 12%, #ffb460 14%); }
.studio { padding: clamp(10px, 2vw, 19px); background: #201d2a; border: 1px solid #423a4e; border-radius: 23px; }
.transport { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 0 0 13px; }
.meter { display: flex; align-items: center; gap: 11px; padding: 0 4px; font-variant-numeric: tabular-nums; }
.meter small { color: var(--muted); }
.beats { display: flex; gap: 4px; }
.beats i { width: 5px; height: 12px; border-radius: 3px; background: #675e73; }
.beats i:nth-child(4n + 1) { height: 16px; margin-top: -2px; }
.beats .lit { background: #aff394; box-shadow: 0 0 9px #99e87b80; }
.controls { display: flex; flex-wrap: wrap; gap: 6px; }
button {
  color: inherit;
  background: #302b3b;
  border: 1px solid #595166;
  border-radius: 10px;
  min-height: 44px;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible { outline: 3px solid #fff4dd; outline-offset: 3px; }
button:disabled { opacity: .48; cursor: default; }
.primary { background: var(--paper); color: #211828; border-color: var(--paper); min-width: 82px; }
.stage {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(2px, 1vw, 12px);
  padding: clamp(5px, 1.5vw, 13px);
  overflow: hidden;
  border: 1px solid #45374c;
  border-radius: 16px;
  background:
    repeating-linear-gradient(90deg, transparent 0 24px, #40324730 24px 25px),
    linear-gradient(180deg, #211a2a 0%, #302235 69%, #221b29 70%, #19151e 100%);
}
.stage-slot {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  min-width: 0;
  height: clamp(98px, 25vw, 205px);
  gap: 5px;
  padding: 5px 1px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #c4bccc;
}
.stage-slot:focus-visible { outline-offset: -1px; }
.ready-to-place .stage-slot { border-color: #81728e; }
.stage-slot.drop-target { background: #4a3b58; border-color: #fbecd0; }
.stage-slot.occupied { color: var(--color); }
.performer {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  isolation: isolate;
  transition: translate 140ms ease-out;
  filter: drop-shadow(0 5px 0 #110e17);
}
.silhouette-head, .silhouette-body {
  position: absolute;
  border: 2px solid #4a3b53;
  background: #17131d;
}
.silhouette-head {
  z-index: 1;
  inset: 18% 13% auto;
  height: 48%;
  background-image: radial-gradient(ellipse at 32% 53%, #4b4054 0 7%, transparent 9%),
    radial-gradient(ellipse at 68% 53%, #4b4054 0 7%, transparent 9%);
  border-radius: 43% 43% 32% 32% / 49% 49% 40% 40%;
}
.silhouette-body {
  inset: auto 20% 0;
  height: 55%;
  border-radius: 57% 57% 24% 24%;
}
.occupied .silhouette-head {
  background-color: var(--color);
  border-color: #1e1725;
  background-image: radial-gradient(ellipse at 32% 53%, #211a2c 0 7%, transparent 9%),
    radial-gradient(ellipse at 68% 53%, #211a2c 0 7%, transparent 9%);
}
.occupied .silhouette-body {
  background: var(--color);
  background: color-mix(in srgb, var(--color) 52%, #251d2d);
  border-color: #1e1725;
}
.costume-mark {
  position: absolute;
  z-index: 2;
  top: 5%;
  left: 50%;
  translate: -50% 0;
  color: var(--color);
  background: #281f31;
  border: 1px solid currentColor;
  border-radius: 30%;
  width: 50%;
  aspect-ratio: 1.3;
  display: grid;
  place-items: center;
  font: 800 clamp(.7rem, 2.7vw, 1.7rem)/1 system-ui, sans-serif;
}
.costume-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}
.playing .offbeat .occupied .performer:not(.synced-performer) { translate: 0 -5px; }
.slot-label {
  min-height: 1em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(.58rem, 2.3vw, .92rem);
}
.status { min-height: 1.3em; margin: 10px 3px 0; color: var(--muted); font-size: .875rem; }
.accessory-tray { margin-top: 16px; }
.accessory-tray h2 { margin: 0 0 9px; font-size: 1rem; }
.accessories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(77px, 1fr));
  gap: 7px;
}
.accessory {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 5px 2px;
  min-width: 0;
  touch-action: pan-y;
  user-select: none;
}
.accessory[aria-pressed="true"] { border-color: var(--color); outline: 1px solid var(--color); }
.accessory .token { touch-action: none; }
.accessory.on-stage .token { opacity: .65; }
.accessory-name { font-size: .875rem; }
.token {
  display: grid;
  place-items: center;
  width: 35px;
  height: 34px;
  border-radius: 11px 11px 9px 9px;
  color: #251d2d;
  background: var(--color);
  box-shadow: inset 0 -3px #1a102937;
  font: 900 1.2rem/1 system-ui, sans-serif;
}
.drag-ghost {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  translate: -50% -50%;
  scale: 1.28;
  box-shadow: 0 4px 12px #0008;
}
@media (hover: hover) { button:not(:disabled):hover { filter: brightness(1.14); } }
@media (max-width: 530px) {
  .hero { margin-top: 0; margin-bottom: 15px; }
  main { padding-top: max(14px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px)); }
  .stage-slot { gap: 3px; }
  .slot-label { font-size: .59rem; }
}
@media (prefers-reduced-motion: reduce) {
  .performer { transition: none; }
  .playing .offbeat .occupied .performer:not(.synced-performer) { translate: none; }
}
#skin-settings { margin: 0 4px 12px; }
#skin-settings:not([hidden]) { display: inline-block; }
#skin-settings, .skin-admin a { color: var(--paper); }
.skin-admin { max-width: 620px; }
.skin-admin form { display: grid; gap: 10px; }
.skin-admin label { font-weight: 700; }
.skin-admin input, .skin-admin select {
  width: 100%;
  padding: 9px;
  color: inherit;
  background: #17151e;
  border: 1px solid #595166;
  border-radius: 8px;
  font: inherit;
}
.skin-admin p { margin: 0; color: var(--muted); }
.skin-preview {
  display: grid;
  place-items: center;
  min-height: 128px;
  padding: 8px;
  background: #17151e;
  border-radius: 10px;
  color: var(--muted);
}
.skin-preview img { width: 112px; height: 112px; object-fit: contain; }

.upload-mapping:not([hidden]) { display: grid; gap: 8px; }
.upload-row {
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 9px;
  background: #17151e;
  border-radius: 8px;
}
.upload-row label, .upload-status { overflow-wrap: anywhere; }
.upload-status { color: var(--muted); font-size: .875rem; }
.upload-status:empty { display: none; }

.accessory-name { white-space: normal; overflow-wrap: anywhere; }
