:root {
  font-family: "Avenir Next", "Segoe UI", Arial, sans-serif;
  color: #fff7de;
  background: #120f1c;
  --ink: #fff7de;
  --canvas-ink: #152032;
  --mint: #86e4be;
  --sun: #ffcb57;
  --sky: #63d6ff;
  --coral: #ff7b57;
  --cream: #fff7de;
  --leaf: #cbf25a;
  --plum: #8e5eff;
  --panel: rgba(18, 25, 40, 0.78);
  --panel-strong:
    linear-gradient(180deg, rgba(36, 22, 44, 0.94), rgba(17, 26, 40, 0.94));
  --panel-soft: rgba(255, 247, 222, 0.08);
  --border: rgba(255, 247, 222, 0.16);
  --shadow: rgba(4, 8, 16, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 123, 87, 0.22), transparent 26%),
    radial-gradient(circle at top right, rgba(99, 214, 255, 0.16), transparent 24%),
    radial-gradient(circle at bottom center, rgba(203, 242, 90, 0.12), transparent 20%),
    linear-gradient(180deg, #1a1324 0%, #101b2f 48%, #0d1728 100%);
  color: var(--cream);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(10, 15, 26, 0.84);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.app-header-copy {
  display: grid;
  gap: 4px;
  max-width: 42rem;
}

.header-summary {
  max-width: 34rem;
  color: rgba(255, 247, 222, 0.74);
  font-size: 13px;
  line-height: 1.4;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--leaf);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.3rem, 4.2vw, 3.8rem);
  line-height: 0.94;
  color: var(--cream);
}

h2 {
  font-size: 26px;
  line-height: 1.1;
  color: var(--cream);
}

h3 {
  font-size: 20px;
  line-height: 1.2;
  color: var(--cream);
}

.studio-main {
  flex: 1;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.screen {
  display: none;
}

.screen.active {
  display: grid;
  gap: 22px;
  align-content: start;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 4px;
}

.section-head p {
  max-width: 560px;
  margin-top: 6px;
  color: rgba(255, 247, 222, 0.76);
}

.tile-grid {
  display: grid;
  gap: 16px;
}

.profile-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.theme-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.tile-button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 18px 48px rgba(3, 7, 14, 0.22);
  padding: 0;
  text-align: left;
  overflow: hidden;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.tile-button.active {
  background:
    linear-gradient(180deg, rgba(255, 203, 87, 0.18), rgba(99, 214, 255, 0.08)),
    var(--panel-strong);
  box-shadow:
    inset 0 0 0 2px rgba(99, 214, 255, 0.75),
    0 18px 48px rgba(3, 7, 14, 0.28);
}

.tile-button img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.profile-grid .tile-button img,
.cast-grid .tile-button img {
  aspect-ratio: 5 / 4;
}

.tile-copy {
  padding: 14px;
  display: grid;
  gap: 8px;
  color: var(--cream);
}

.tile-copy p {
  font-size: 14px;
  line-height: 1.35;
  color: rgba(255, 247, 222, 0.76);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--sun);
  border: 1px solid rgba(255, 247, 222, 0.2);
  color: var(--canvas-ink);
  font-size: 13px;
  font-weight: 700;
}

.seed-actions,
.prompt-actions,
.viewer-head,
.viewer-head-actions,
.page-meta,
.story-end-actions,
.parent-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.seed-actions {
  justify-content: space-between;
  margin-bottom: 20px;
}

.continuity-row {
  margin-top: 28px;
  align-items: flex-end;
}

.helper-text {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.35;
}

.action-button,
.ghost-button,
.nav-button {
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 48px;
  padding: 0 18px;
  font-weight: 700;
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.world-home-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 6px 12px 6px 8px;
  border: 1px solid rgba(255, 247, 222, 0.24);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 183, 3, 0.26), rgba(20, 184, 166, 0.18)),
    rgba(255, 247, 222, 0.08);
  color: var(--cream);
  text-decoration: none;
  box-shadow: 0 8px 0 rgba(4, 8, 16, 0.16);
}

.world-home-link strong,
.world-home-link small {
  display: block;
  line-height: 1.05;
}

.world-home-link small {
  margin-top: 3px;
  color: rgba(255, 247, 222, 0.72);
  font-size: 11px;
  text-transform: uppercase;
}

.world-home-kids {
  position: relative;
  width: 82px;
  height: 42px;
  flex: 0 0 auto;
}

.world-home-kids img {
  position: absolute;
  bottom: -4px;
  width: 36px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 5px 0 rgba(4, 8, 16, 0.24));
}

.world-home-kids img:nth-child(1) {
  left: 0;
}

.world-home-kids img:nth-child(2) {
  left: 24px;
}

.world-home-kids img:nth-child(3) {
  left: 48px;
  width: 42px;
}

.action-button {
  background: var(--coral);
  color: var(--canvas-ink);
  box-shadow: 0 12px 24px rgba(255, 123, 87, 0.18);
}

.action-button.surprise {
  background: var(--sun);
}

.ghost-button {
  background: rgba(255, 247, 222, 0.94);
  color: var(--canvas-ink);
}

.ghost-button.danger {
  background: #ffd2c5;
}

.ghost-button.wide {
  width: 100%;
  justify-content: center;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.theme-strip,
.prompt-strip {
  margin-top: 0;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 18px 42px rgba(3, 7, 14, 0.22);
}

.composer-strip {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(142, 94, 255, 0.18), rgba(255, 123, 87, 0.08)),
    var(--panel-strong);
}

.composer-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer-quick-row .ghost-button {
  min-height: 40px;
  padding: 0 12px;
}

.composer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.story-card-banks {
  display: grid;
  gap: 12px;
}

.story-card-bank {
  display: grid;
  gap: 10px;
}

.bank-head {
  display: grid;
  gap: 4px;
}

.bank-head h4 {
  margin: 0;
}

.story-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.story-card-button {
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.08);
  color: var(--cream);
  text-align: left;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.story-card-button strong {
  font-size: 15px;
}

.story-card-button span {
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255, 247, 222, 0.72);
}

.story-card-button.active {
  background: rgba(255, 203, 87, 0.18);
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 2px rgba(255, 203, 87, 0.52);
}

.simple-answer-strip {
  display: grid;
  gap: 12px;
}

.simple-answer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
}

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mic-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.mic-button {
  min-height: 44px;
  padding: 0 12px;
  white-space: nowrap;
}

.mic-button.recording {
  background: #ffd86d;
}

.mic-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.strip-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.cast-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 132px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 247, 222, 0.06);
  color: var(--cream);
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 247, 222, 0.06);
  color: var(--cream);
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 247, 222, 0.48);
}

.loading-screen {
  display: none;
  align-items: center;
  gap: 24px;
}

.loading-screen.active {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  min-height: calc(100vh - 180px);
}

.loading-illustration {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    radial-gradient(circle at top right, rgba(255, 247, 222, 0.22), transparent 18%),
    linear-gradient(180deg, rgba(99, 214, 255, 0.18), rgba(255, 123, 87, 0.1)),
    var(--panel-strong);
  box-shadow: 0 24px 56px rgba(3, 7, 14, 0.28);
}

.loading-illustration img {
  width: 100%;
  min-height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  opacity: 0.92;
}

.loading-copy {
  display: grid;
  gap: 12px;
  align-content: center;
  min-height: 100%;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 203, 87, 0.14), rgba(18, 25, 40, 0.84)),
    var(--panel-strong);
  box-shadow: 0 20px 48px rgba(3, 7, 14, 0.24);
}

.loading-copy h2 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.96;
}

#loading-line {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.5;
  color: rgba(255, 247, 222, 0.82);
}

.viewer-screen {
  display: none;
}

.viewer-screen.active {
  display: grid;
  gap: 16px;
}

.viewer-head {
  justify-content: space-between;
  align-items: flex-start;
}

.viewer-head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-button:hover,
.action-button:hover,
.nav-button:hover,
.tile-button:hover,
.story-card-button:hover,
.layer-pack-chip:hover {
  transform: translateY(-1px);
}

.ghost-button:focus-visible,
.action-button:focus-visible,
.nav-button:focus-visible,
.tile-button:focus-visible,
.story-card-button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(99, 214, 255, 0.82);
  outline-offset: 2px;
}

.story-stage {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 12px;
}

.page-frame {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 0;
  overflow: hidden;
  width: 100%;
  box-shadow: 0 24px 56px rgba(3, 7, 14, 0.28);
}

.page-frame img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.nav-button {
  background: rgba(255, 247, 222, 0.94);
  color: var(--canvas-ink);
  font-size: 28px;
  padding: 0;
}

.page-copy {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
}

.page-meta {
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 247, 222, 0.72);
}

#page-narration {
  font-size: 20px;
  line-height: 1.45;
  min-height: 88px;
  color: var(--cream);
}

.page-dialogue {
  display: grid;
  gap: 8px;
}

.page-dialogue.hidden {
  display: none;
}

.dialogue-line {
  border-left: 4px solid var(--sun);
  padding-left: 10px;
  font-size: 16px;
  line-height: 1.4;
  color: rgba(255, 247, 222, 0.88);
}

.dialogue-line strong {
  display: inline-block;
  margin-right: 6px;
}

.story-end-actions.hidden,
.video-jobs.hidden,
.parent-panel.hidden {
  display: none;
}

.story-end-actions {
  flex-wrap: wrap;
}

.video-jobs {
  display: grid;
  gap: 10px;
  padding-top: 6px;
}

.job-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.06);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.parent-panel {
  position: fixed;
  top: 104px;
  right: 16px;
  bottom: 16px;
  width: min(520px, calc(100vw - 32px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(142, 94, 255, 0.14), rgba(18, 25, 40, 0.94)),
    var(--panel-strong);
  padding: 18px;
  box-shadow: 0 24px 64px var(--shadow);
}

.parent-block {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.06);
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.06);
  padding: 12px;
  text-align: left;
}

.selected-blueprint {
  box-shadow: inset 0 0 0 4px var(--sky);
}

.active-edit {
  background: #fff6d6;
}

.blueprint-list {
  display: grid;
  gap: 10px;
}

.rig-view-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.rig-view-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: #ffffff;
  color: var(--ink);
}

.rig-view-badge--available {
  background: var(--mint);
  color: var(--ink);
}

.rig-view-badge--unavailable {
  background: transparent;
  border-style: dashed;
  color: rgba(31, 36, 25, 0.55);
  border-color: rgba(31, 36, 25, 0.45);
}

.rig-view-badge__icon {
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
}

.rig-view-badge--available .rig-view-badge__icon::before {
  content: "\2713";
}

.rig-view-badge--unavailable .rig-view-badge__icon::before {
  content: "\2013";
}

.starter-grid {
  display: grid;
  gap: 10px;
}

.starter-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.06);
  padding: 10px;
}

.starter-card img {
  width: 84px;
  height: 84px;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.starter-card-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.starter-card-copy strong,
.starter-card-copy p {
  overflow-wrap: anywhere;
}

.starter-card-copy p {
  font-size: 13px;
  line-height: 1.35;
}

.starter-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.starter-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.starter-card-actions .ghost-button,
.starter-card-actions .action-button {
  min-height: 38px;
  padding: 0 12px;
}

.creator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.voice-attach-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto auto;
  gap: 10px 12px;
  align-items: end;
}

#voice-preview-audio {
  width: 100%;
}

.layer-pack-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.06);
  padding: 12px;
}

.family-pack-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.family-pack-card {
  display: grid;
  gap: 0;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 247, 222, 0.05);
  color: var(--cream);
  text-align: left;
  font: inherit;
}

.family-pack-art {
  aspect-ratio: 16 / 10;
  background: rgba(255, 247, 222, 0.06);
  border-bottom: 1px solid rgba(255, 247, 222, 0.1);
}

.family-pack-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.family-pack-card-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.family-pack-card strong,
.family-pack-card p {
  overflow-wrap: anywhere;
}

.family-pack-card.active {
  box-shadow: inset 0 0 0 2px var(--sun);
  border-color: rgba(255, 203, 87, 0.7);
}

.family-pack-card.unavailable {
  opacity: 0.72;
}

.family-pack-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.family-pack-status {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(255, 247, 222, 0.72);
}

.layer-pack-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.layer-pack-selector.hidden {
  display: none;
}

.layer-pack-chip {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.08);
  color: var(--cream);
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.layer-pack-chip.active {
  background: rgba(255, 203, 87, 0.18);
}

.layer-pack-builder {
  display: grid;
  gap: 12px;
}

.layer-pack-builder.hidden {
  display: none;
}

.layer-pack-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(99, 214, 255, 0.12), rgba(255, 123, 87, 0.08)),
    rgba(255, 247, 222, 0.04);
}

.layer-pack-stage.hidden {
  display: none;
}

.layer-pack-stage-copy {
  display: grid;
  gap: 10px;
  align-content: start;
}

.layer-pack-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.layer-pack-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.08);
  color: var(--cream);
  padding: 0 10px;
}

.field-stack {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}

.creator-status {
  min-height: 20px;
}

.creator-status[data-kind="error"] {
  color: #ff9e8d;
}

.creator-status[data-kind="success"] {
  color: #cbf25a;
}

.slot-lane {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 247, 222, 0.1);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.03);
}

.slot-lane-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.slot-lane-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.slot-kicker {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--sun);
}

.slot-lane-copy strong,
.slot-lane-copy p {
  overflow-wrap: anywhere;
}

.slot-option-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(120px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.slot-option {
  min-height: 84px;
  border: 1px solid rgba(255, 247, 222, 0.12);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.06);
  color: var(--cream);
  padding: 12px;
  display: grid;
  gap: 8px;
  align-content: space-between;
  text-align: left;
  font: inherit;
}

.slot-option:hover {
  border-color: rgba(255, 203, 87, 0.42);
}

.slot-option.active {
  border-color: rgba(255, 203, 87, 0.84);
  background: rgba(255, 203, 87, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 203, 87, 0.35);
}

.slot-option-name {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
}

.slot-option small {
  font-size: 11px;
  color: rgba(255, 247, 222, 0.72);
}

.slot-shuffle {
  white-space: nowrap;
}

.microcopy {
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
}

.inline-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.empty-copy {
  font-size: 14px;
  line-height: 1.35;
}

.reference-dropzone {
  display: grid;
  gap: 10px;
  border: 1px dashed rgba(255, 247, 222, 0.42);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.06);
  padding: 12px;
  transition: background 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.reference-dropzone.active {
  background: rgba(99, 214, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(99, 214, 255, 0.68);
  transform: translateY(-1px);
}

.reference-dropzone-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.reference-dropzone-head strong {
  display: block;
  margin-bottom: 2px;
}

.reference-asset-list {
  display: grid;
  gap: 8px;
}

.reference-asset-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.08);
  padding: 8px;
}

.reference-asset-thumb {
  width: 64px;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 247, 222, 0.08);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.reference-asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reference-asset-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.reference-asset-copy strong,
.reference-asset-copy p {
  overflow-wrap: anywhere;
}

.reference-asset-copy p {
  font-size: 12px;
  line-height: 1.35;
}

.reference-asset-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.reference-asset-field {
  display: grid;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
}

.reference-asset-field input,
.reference-asset-field textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.08);
  color: var(--cream);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 500;
}

.reference-asset-field textarea {
  min-height: 68px;
  resize: vertical;
}

.reference-asset-field-wide {
  grid-column: 1 / -1;
}

.reference-asset-actions {
  display: grid;
  gap: 6px;
}

.reference-asset-actions .ghost-button {
  min-height: 38px;
  padding: 0 12px;
}

.asset-editor-toggle {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.06);
  padding: 10px 12px;
}

.asset-editor-toggle summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.asset-editor-panel {
  margin-top: 10px;
}

.ghost-button:disabled,
.action-button:disabled,
.nav-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.creator-preview-shell {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 247, 222, 0.08);
}

.creator-preview-shell.hidden {
  display: none;
}

.creator-preview-shell img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.creator-version-panel {
  display: grid;
  gap: 12px;
}

.creator-version-list {
  display: grid;
  gap: 10px;
}

.creator-version-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.08);
  padding: 10px;
}

.creator-version-card.active {
  box-shadow: inset 0 0 0 2px rgba(99, 214, 255, 0.68);
}

.creator-version-card img {
  width: 88px;
  height: 88px;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.creator-version-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.creator-version-copy p,
.creator-version-copy strong {
  overflow-wrap: anywhere;
}

.creator-version-copy p {
  font-size: 13px;
  line-height: 1.35;
}

.creator-version-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.creator-version-actions {
  display: grid;
  gap: 8px;
}

.creator-version-actions .ghost-button {
  min-height: 40px;
  padding: 0 12px;
}

@media (max-width: 760px) {
  .app-header {
    padding: 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .studio-main {
    width: calc(100% - 24px);
    padding-top: 18px;
  }

  h1 {
    font-size: 2.65rem;
  }

  .header-summary {
    max-width: none;
  }

  .app-header .viewer-head-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 10px;
  }

  .app-header .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .loading-screen.active {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .viewer-head,
  .section-head,
  .seed-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .story-stage {
    grid-template-columns: 1fr;
  }

  .nav-button {
    min-height: 44px;
  }

  .theme-strip,
  .prompt-strip,
  .composer-strip,
  .page-copy,
  .parent-block,
  .loading-copy {
    padding: 16px;
  }

  .parent-panel {
    top: 74px;
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .creator-grid {
    grid-template-columns: 1fr;
  }

  .voice-attach-row {
    grid-template-columns: 1fr;
  }

  .simple-answer-grid {
    grid-template-columns: 1fr;
  }

  .composer-grid {
    grid-template-columns: 1fr;
  }

  .starter-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .family-pack-grid {
    grid-template-columns: 1fr;
  }

  .layer-pack-stage {
    grid-template-columns: 1fr;
  }

  .starter-card img {
    width: 72px;
    height: 72px;
  }

  .reference-asset-row {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .reference-asset-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reference-asset-meta-grid {
    grid-template-columns: 1fr;
  }

  .reference-asset-row .ghost-button {
    grid-column: 1 / -1;
  }

  .creator-version-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .creator-version-card img {
    width: 72px;
    height: 72px;
  }

  .creator-version-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --- Sprite Action Studio --- */
.sprites-body { margin:0; background:#0d1117; color:#e8e8f0; font-family:system-ui,sans-serif; }
.sprites-header { display:flex; justify-content:space-between; align-items:center; padding:10px 16px; background:#1a1f2e; border-bottom:1px solid #2a3045; }
.sprites-header-left { display:flex; align-items:center; gap:12px; }
.sprites-header-left h1 { margin:0; font-size:16px; }
.sprites-header-right { display:flex; gap:8px; align-items:center; }
.sprites-backdrop-picker { display:flex; align-items:center; gap:6px; font-size:12px; color:#9aa; }
.sprites-main { display:grid; grid-template-columns:210px 1fr 240px; height:calc(100vh - 56px); }
.sprites-cast { background:#1a1f2e; padding:12px; border-right:1px solid #2a3045; overflow-y:auto; }
.sprites-cast-row { display:flex; gap:8px; align-items:center; padding:8px; background:#252b3d; border-radius:6px; margin-bottom:6px; cursor:grab; }
.sprites-cast-row.is-empty { opacity:.55; }
.sprites-cast-thumb { width:36px; height:36px; border-radius:6px; background:#3a4060; display:flex; align-items:center; justify-content:center; font-size:18px; }
.sprites-cast-meta { flex:1; font-size:12px; }
.sprites-cast-meta small { display:block; color:#8a8; font-size:10px; }
.sprites-stage { position:relative; background:#3a5840; overflow:hidden; }
.sprites-backdrop { position:absolute; inset:0; background-size:cover; background-position:center; }
.sprites-layer { position:absolute; inset:0; }
.sprites-status { position:absolute; bottom:12px; left:12px; right:12px; background:rgba(0,0,0,.6); padding:8px 12px; border-radius:6px; font-size:11px; color:#cfd; }
.sprites-character { position:absolute; transform:translate(-50%,-100%); cursor:grab; }
.sprites-character.is-selected { outline:3px solid #5b6cff; outline-offset:4px; border-radius:6px; }
.sprites-character img { pointer-events:none; user-select:none; max-height:180px; }
.sprites-character.face-left img { transform:scaleX(-1); }
.sprites-actions { background:#1a1f2e; padding:12px; border-left:1px solid #2a3045; overflow-y:auto; }
.sprites-actions-empty { color:#9aa; font-size:12px; }
.sprites-action-group-label { font-size:10px; color:#9aa; text-transform:uppercase; margin:10px 0 4px; }
.sprites-action-grid { display:grid; grid-template-columns:1fr 1fr; gap:4px; }
.sprites-action-btn { font-size:11px; padding:5px; border:1px solid #2a3045; background:#252b3d; color:#cfd; border-radius:4px; cursor:pointer; }
.sprites-action-btn.is-active { background:#5b6cff; border-color:#5b6cff; color:#fff; }
.sprites-action-btn.is-missing { opacity:.5; }
.sprites-drawer { border:none; background:#1a1f2e; color:#e8e8f0; padding:16px; border-radius:8px; width:min(600px,90vw); }
.sprites-drawer::backdrop { background:rgba(0,0,0,.6); }
.sprites-drawer header { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.sprites-prompt-body { background:#0d1117; color:#cdd6f4; padding:10px; border-radius:4px; font-size:11px; white-space:pre-wrap; max-height:320px; overflow:auto; }
.sprites-prompt-refs { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; font-size:11px; }
.sprites-prompt-refs span { background:#252b3d; padding:2px 8px; border-radius:3px; }
.sprites-prompt-actions { display:flex; gap:8px; margin-top:12px; }

/* --- Puppet Compositor Preview --- */
.compositor-body { margin:0; background:#0d1117; color:#e8e8f0; font-family:system-ui,sans-serif; }
.compositor-header { display:flex; justify-content:space-between; align-items:center; padding:10px 16px; background:#1a1f2e; border-bottom:1px solid #2a3045; }
.compositor-header-left { display:flex; align-items:center; gap:12px; }
.compositor-header-left h1 { margin:0; font-size:16px; }
.compositor-header-right { display:flex; gap:12px; align-items:center; }
.compositor-kit-picker { display:flex; align-items:center; gap:6px; font-size:12px; color:#9aa; }
.compositor-toggle { display:flex; align-items:center; gap:4px; font-size:12px; color:#9aa; }
.compositor-main { display:grid; grid-template-columns:260px 1fr 260px; height:calc(100vh - 56px); }
.compositor-parts { background:#1a1f2e; padding:12px; border-right:1px solid #2a3045; overflow-y:auto; }
.compositor-parts h3 { margin:0 0 8px; font-size:12px; color:#9aa; text-transform:uppercase; }
.compositor-parts-row { display:flex; align-items:center; gap:6px; margin-bottom:6px; font-size:12px; }
.compositor-parts-row > span { flex:0 0 80px; color:#9aa; font-family:ui-monospace,monospace; font-size:11px; }
.compositor-parts-row select { flex:1; background:#252b3d; color:#cfd; border:1px solid #2a3045; border-radius:4px; padding:4px 6px; font-size:11px; }
.compositor-parts-row .compositor-reset { background:transparent; color:#8a8; border:none; cursor:pointer; font-size:11px; padding:2px 4px; }
.compositor-parts-row .compositor-reset:hover { color:#fcc; }
.compositor-stage { display:flex; flex-direction:column; align-items:center; justify-content:center; background:#11151c; padding:16px; position:relative; overflow:auto; }
.compositor-frame { position:relative; width:min(720px, calc(100vh - 160px)); aspect-ratio:1; background:linear-gradient(#fafafa,#ececec); border-radius:8px; box-shadow:0 0 0 1px #2a3045, 0 4px 24px rgba(0,0,0,0.4); overflow:hidden; }
.compositor-layers { position:absolute; inset:0; }
.compositor-layers img { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; user-select:none; }
.compositor-anchors { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; display:none; }
.compositor-anchors.is-on { display:block; }
.compositor-stage-footer { margin-top:12px; color:#9aa; font-size:11px; font-family:ui-monospace,monospace; text-align:center; }
.compositor-inspector { background:#1a1f2e; padding:12px; border-left:1px solid #2a3045; overflow-y:auto; font-size:12px; }
.compositor-inspector h3 { margin:0 0 8px; font-size:12px; color:#9aa; text-transform:uppercase; }
.compositor-inspector-empty { color:#9aa; font-size:11px; }
.compositor-inspector-body { font-family:ui-monospace,monospace; font-size:11px; color:#cdd6f4; line-height:1.5; }
.compositor-inspector-body dt { color:#9aa; margin-top:6px; }
.compositor-inspector-body dd { margin:2px 0 0; }
.compositor-inspector-body img.preview { margin-top:8px; max-width:200px; border:1px solid #2a3045; border-radius:4px; background:linear-gradient(#fafafa,#ececec); }
.compositor-section-label { font-size:10px; color:#5b6cff; text-transform:uppercase; margin:14px 0 4px; font-weight:600; }
.compositor-warning { margin:10px 0; padding:8px; border:1px solid #a86; border-radius:4px; color:#fcb; font-size:11px; }

/* --- Puppet Compositor Preview: compare mode + snapshot + shortcuts --- */
.compositor-main[data-mode="single"] { grid-template-columns:260px 1fr 260px; }
.compositor-main[data-mode="single"] #stage-secondary { display:none; }
.compositor-main[data-mode="compare"] { grid-template-columns:260px 1fr 1fr 260px; }
.compositor-stage-compare { display:flex; flex-direction:column; align-items:center; justify-content:center; background:#0e1219; padding:16px; position:relative; overflow:auto; }
.compositor-stage-compare .compositor-frame { width:min(560px, calc(100vh - 200px)); }
.compositor-stage-header { width:100%; display:flex; justify-content:center; padding-bottom:8px; }
.compositor-stage-header .compositor-kit-picker { background:#1a1f2e; padding:4px 10px; border-radius:6px; border:1px solid #2a3045; }
.compositor-shortcuts { color:#9aa; font-size:11px; line-height:1.5; margin-top:14px; padding-top:10px; border-top:1px solid #2a3045; }
.compositor-shortcuts kbd { background:#252b3d; border:1px solid #2a3045; border-radius:3px; padding:1px 5px; font-family:ui-monospace,monospace; font-size:10px; color:#cfd; }
.compositor-parts-row.is-focused { outline:2px solid #5b6cff; outline-offset:1px; border-radius:4px; }

/* --- Hop Game (side-scroller minigame) --- */
.hopgame-body { margin:0; background:#0d1117; color:#e8e8f0; font-family:system-ui,sans-serif; overflow:hidden; }
.hopgame-header { display:flex; justify-content:space-between; align-items:center; padding:8px 16px; background:#1a1f2e; border-bottom:1px solid #2a3045; }
.hopgame-header h1 { margin:0; font-size:16px; }
.hopgame-header-right { display:flex; gap:12px; align-items:center; font-family:ui-monospace,monospace; font-size:14px; color:#ffd97a; }
.hopgame-status-pill { display:inline-flex; align-items:center; min-height:32px; padding:0 10px; border:1px solid #2a3045; border-radius:999px; background:#101625; color:#9fd8ff; font-size:12px; }
.hopgame-main { display:flex; align-items:center; justify-content:center; height:calc(100vh - 48px); }
.hopgame-pick { max-width:1100px; width:100%; padding:20px; text-align:center; }
.hopgame-pick h2 { font-size:22px; margin:0 0 18px; }
.hopgame-mode-bar { display:flex; justify-content:center; gap:10px; margin:0 0 10px; flex-wrap:wrap; }
.hopgame-mode-button { min-width:140px; }
.hopgame-mode-button.is-active { border-color:#5b6cff; box-shadow:inset 0 0 0 1px rgba(91,108,255,0.4); background:#202843; }
.hopgame-mode-copy { max-width:620px; margin:0 auto 14px; color:#9fb3d5; font-size:13px; line-height:1.4; }
.hopgame-hint { color:#9aa; font-size:12px; margin-top:16px; }
.hopgame-character-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:14px; }
.hopgame-character-card { background:#1a1f2e; border:1px solid #2a3045; border-radius:10px; padding:12px; cursor:pointer; transition:transform 0.1s ease, border-color 0.1s ease; }
.hopgame-character-card:hover { transform:translateY(-3px); border-color:#5b6cff; }
.hopgame-character-card.is-loading { opacity:0.6; pointer-events:none; }
.hopgame-character-thumb { width:100%; aspect-ratio:1; background:linear-gradient(#a8d8ff, #fff); border-radius:8px; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.hopgame-character-thumb img { max-width:85%; max-height:85%; object-fit:contain; image-rendering:auto; }
.hopgame-character-name { margin-top:8px; font-size:13px; font-weight:600; }
.hopgame-character-coverage { font-size:11px; color:#8a8; }
.hopgame-pick[hidden],
.hopgame-game[hidden] { display:none!important; }
.hopgame-game { position:relative; width:100%; height:100%; display:flex; align-items:center; justify-content:center; background:#0a0d14; }
#game-canvas { image-rendering:pixelated; background:#87c9f5; border-radius:8px; box-shadow:0 0 0 1px #2a3045, 0 8px 32px rgba(0,0,0,0.5); max-width:100%; max-height:100%; }
.hopgame-overlay { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; background:rgba(10,13,20,0.88); backdrop-filter:blur(4px); }
.hopgame-overlay h2 { font-size:32px; margin:0 0 8px; }
.hopgame-overlay p { color:#cdd6f4; font-size:14px; margin:0 0 18px; }
.hopgame-overlay-actions { display:flex; gap:10px; }
.hopgame-overlay-settings { margin-top:18px; min-width:min(360px, 90vw); padding:16px 18px; border:1px solid #2a3045; border-radius:10px; background:rgba(17,22,34,0.88); box-shadow:0 8px 32px rgba(0,0,0,0.35); }
.hopgame-overlay-settings h3 { margin:0 0 12px; font-size:15px; }
.hopgame-overlay-slider { display:grid; gap:6px; margin:10px 0 0; color:#cdd6f4; font-size:13px; text-align:left; }
.hopgame-overlay-slider input { width:100%; }

/* --- Playback Preview --- */
.playback-body {
  margin: 0;
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 203, 87, 0.18), transparent 28%),
    radial-gradient(circle at 90% 10%, rgba(99, 214, 255, 0.18), transparent 26%),
    linear-gradient(180deg, #151722 0%, #0e1728 100%);
  color: #fff7de;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
}

.playback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  background: rgba(12, 18, 30, 0.92);
  border-bottom: 1px solid rgba(255, 247, 222, 0.14);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.playback-header h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  letter-spacing: -0.03em;
}

.playback-header-left,
.playback-header-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.playback-speed {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: rgba(255, 247, 222, 0.72);
}

.playback-speed select {
  background: #26344c;
  color: #d9ffe9;
  border: 1px solid rgba(255, 247, 222, 0.16);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}

.playback-main {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.playback-hint {
  color: rgba(255, 247, 222, 0.76);
  font-size: 14px;
  margin: 0 0 14px;
}

.playback-empty {
  color: #ffcb57;
  font-weight: 800;
}

.playback-pack-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sprite-qa-rules,
.playback-pack {
  background:
    linear-gradient(135deg, rgba(255, 247, 222, 0.08), rgba(99, 214, 255, 0.04)),
    rgba(20, 28, 44, 0.88);
  border: 1px solid rgba(255, 247, 222, 0.14);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 20px 50px rgba(4, 8, 16, 0.24);
}

.sprite-qa-rules h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

.sprite-qa-rules ul {
  margin: 0;
  padding-left: 20px;
  color: rgba(255, 247, 222, 0.76);
  line-height: 1.45;
}

.sprite-qa-track.is-critical {
  border-color: rgba(255, 203, 87, 0.38);
}

.playback-pack.is-missing-assets {
  border-color: rgba(255, 123, 87, 0.48);
  background: #181c2a;
}

.playback-pack-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 12px;
}

.playback-pack-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.playback-pack-meta {
  font-size: 11px;
  color: rgba(255, 247, 222, 0.58);
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
}

.playback-state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.playback-state {
  background: rgba(8, 13, 24, 0.46);
  border: 1px solid rgba(255, 247, 222, 0.1);
  border-radius: 14px;
  padding: 10px;
  text-align: left;
}

.playback-state.is-missing-assets,
.playback-state.is-needs-frames {
  outline: 1px solid rgba(255, 123, 87, 0.62);
}

.playback-state canvas {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(#e6f4ff, #c5dff5);
  border-radius: 10px;
  display: block;
  image-rendering: auto;
}

.playback-state-label {
  font-size: 15px;
  font-weight: 900;
  margin-top: 9px;
  color: #fff7de;
}

.playback-state-meta {
  font-size: 11px;
  color: #86e4be;
  font-family: ui-monospace, monospace;
  margin-top: 2px;
}

.sprite-qa-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.sprite-qa-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(255, 123, 87, 0.18);
  border: 1px solid rgba(255, 123, 87, 0.36);
  color: #ffd2c6;
  font-size: 11px;
  font-weight: 800;
}

.sprite-qa-badge.is-ready {
  background: rgba(134, 228, 190, 0.14);
  border-color: rgba(134, 228, 190, 0.36);
  color: #d9ffe9;
}

.sprite-qa-notes {
  margin-top: 8px;
  color: rgba(255, 247, 222, 0.64);
  font-size: 12px;
  line-height: 1.35;
}

/* --- Hop Game v2.1: leaderboard + HUD extensions --- */
#hud-best { color:#9ae39a; font-family:ui-monospace,monospace; font-size:13px; }
.hopgame-leaderboard { border:none; background:#1a1f2e; color:#e8e8f0; padding:18px; border-radius:10px; width:min(500px, 90vw); box-shadow:0 0 0 1px #2a3045, 0 12px 48px rgba(0,0,0,.6); }
.hopgame-leaderboard::backdrop { background:rgba(0,0,0,.7); }
.hopgame-leaderboard header { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.hopgame-leaderboard h2 { margin:0; font-size:18px; }
.hopgame-leaderboard-list { padding-left:24px; margin:0; }
.hopgame-leaderboard-list li { padding:6px 0; font-family:ui-monospace,monospace; font-size:13px; display:flex; justify-content:space-between; gap:8px; border-bottom:1px dotted #2a3045; }
.hopgame-leaderboard-list li span.name { color:#cfd; flex:1; }
.hopgame-leaderboard-list li span.score { color:#ffd97a; font-weight:600; }
.hopgame-leaderboard-list li span.meta { color:#8a8; font-size:10px; }
.hopgame-leaderboard-empty { color:#9aa; font-size:12px; text-align:center; padding:20px; }

@media (max-width: 980px) {
  .hopgame-header { flex-wrap:wrap; gap:8px; }
  .hopgame-header-right { flex-wrap:wrap; justify-content:flex-end; }
  .hopgame-main { height:auto; min-height:calc(100vh - 48px); padding-bottom:18px; }
  .hopgame-pick { padding:16px; }
  .hopgame-overlay-actions { flex-wrap:wrap; justify-content:center; }
}

/* Hop game on-screen touch controls (Mario-3 style). Shown by default; the
   keyboard still works in parallel. The buttons live inside the game-screen
   section absolute-positioned over the canvas. */
.hopgame-touch-controls {
  position: absolute;
  left: 0; right: 0;
  bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 12px;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 6;
}
.hopgame-touch-controls[hidden] { display: none !important; }
.hopgame-tc-btn {
  pointer-events: auto;
  min-width: 56px;
  height: 56px;
  padding: 8px 14px;
  margin: 4px;
  background: rgba(20, 26, 50, 0.55);
  color: #cdd6f4;
  border: 2px solid rgba(108, 127, 173, 0.7);
  border-radius: 50%;
  font-size: 22px;
  font-weight: bold;
  font-family: system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.08s, transform 0.08s;
}
.hopgame-tc-btn:active,
.hopgame-tc-btn.is-pressed {
  background: rgba(108, 127, 173, 0.85);
  transform: scale(0.92);
}
.hopgame-tc-run    { font-size: 14px; min-width: 64px; background: rgba(60, 30, 80, 0.65); }
.hopgame-tc-attack { font-size: 22px; background: rgba(80, 30, 30, 0.65); }
.hopgame-tc-jump   { font-size: 14px; min-width: 84px; background: rgba(30, 60, 80, 0.65); }

@media (max-width: 600px) {
  .hopgame-tc-btn { min-width: 48px; height: 48px; padding: 6px 10px; font-size: 18px; }
}
