:root {
  --bg: #f5eee7;
  --bg-deep: #eddccf;
  --surface: rgba(255, 250, 244, 0.48);
  --surface-strong: rgba(255, 250, 244, 0.72);
  --line: rgba(124, 86, 60, 0.14);
  --line-strong: rgba(124, 86, 60, 0.24);
  --text: #4b3326;
  --muted: #8e6d58;
  --accent: #bc7a50;
  --accent-deep: #9d5d34;
  --shadow: 0 24px 70px rgba(128, 89, 63, 0.15);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: url(/assets/BYJ-BG.png) center / cover no-repeat fixed;
  color: var(--text);
  font: 400 15px/1.6 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body.overlay-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  box-shadow: none;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell,
.admin-app {
  width: min(100vw - 24px, 100%);
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 0 28px;
}

[data-page="studio"] .app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.studio-app {
  min-height: calc(100vh - 48px);
  display: grid;
  align-items: center;
}

[data-page="studio"] .studio-app {
  min-height: unset;
  flex: 1;
  padding-bottom: 20px;
}

.studio-stage {
  display: grid;
  gap: 24px;
}

.stage-copy {
  display: grid;
  gap: 10px;
}

.stage-copy.compact {
  gap: 6px;
}

.eyebrow {
  margin: 0;
  color: #aa7b5b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stage-copy h1,
.stage-copy h2,
.loading-copy h3,
.picker-head h3,
.result-copy h3,
.admin-hero h1,
.section-heading h2,
.school-row-copy h3 {
  margin: 0;
  font-weight: 600;
}

.stage-copy h1 {
  font-size: 34px;
  line-height: 1.16;
}

.stage-copy h2,
.admin-hero h1 {
  font-size: 28px;
  line-height: 1.2;
}

.stage-text,
.result-copy p,
.loading-copy p,
.school-row-copy p,
.hint-text {
  margin: 0;
  color: var(--muted);
}

.glass-panel,
.admin-section,
.picker-sheet,
.loading-stage,
.asset-modal {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 251, 247, 0.52), rgba(255, 248, 241, 0.36)),
    linear-gradient(145deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(255, 255, 255, 0.16),
    var(--shadow);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
}

.selection-panel,
.upload-panel,
.result-frame {
  padding: 18px;
  border-radius: var(--radius-xl);
}

.selection-panel {
  display: grid;
  gap: 14px;
}

.picker-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--text);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    0 10px 24px rgba(138, 103, 77, 0.08);
}

.upload-button-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 160px;
  padding: 24px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--text);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    0 10px 24px rgba(138, 103, 77, 0.08);
  transition: border-color 140ms ease, background 140ms ease;
}

.upload-button-wrap:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.48);
}

.upload-icon {
  flex-shrink: 0;
  opacity: 0.5;
}

.picker-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.picker-label {
  color: var(--muted);
  font-size: 13px;
}

.picker-button strong {
  font-size: 18px;
  font-weight: 600;
}

.upload-button-main {
  font-size: 22px;
  font-weight: 600;
}

.upload-button-wrap input {
  display: none;
}

.full-button,
.primary-button,
.secondary-button,
.ghost-button,
.text-link,
.sheet-close {
  border-radius: 18px;
  transition: background-color 140ms ease, border-color 140ms ease, opacity 140ms ease, color 140ms ease;
}

.primary-button,
.secondary-button,
.ghost-button,
.sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0 18px;
  text-align: center;
  white-space: nowrap;
}

.primary-button {
  background: linear-gradient(180deg, #c88559, #b46c42);
  color: #fff8f2;
  box-shadow: 0 16px 32px rgba(180, 108, 66, 0.2);
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.42);
  border-color: var(--line);
  color: var(--text);
}

.ghost-button,
.sheet-close {
  background: rgba(255, 255, 255, 0.24);
  border-color: var(--line);
  color: var(--muted);
}

.text-link {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

a:focus,
a:focus-visible,
button:focus,
button:focus-visible,
input:focus,
input:focus-visible,
select:focus,
select:focus-visible,
textarea:focus,
textarea:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.subtle-link {
  justify-self: start;
}

.result-frame {
  overflow: hidden;
}

.result-state {
  min-height: 320px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.24);
}

.result-state.empty {
  display: grid;
  place-items: center;
}

.result-state.image img {
  width: 100%;
  height: auto;
  min-height: 320px;
  max-height: 72vh;
  object-fit: cover;
  border-radius: 22px;
}

.result-copy {
  width: min(320px, calc(100% - 32px));
  text-align: center;
  display: grid;
  gap: 8px;
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stage-result > .stage-copy,
.stage-result > .result-actions {
  padding-left: 18px;
  padding-right: 18px;
}

.picker-overlay,
.loading-overlay,
.asset-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.picker-overlay[hidden],
.loading-overlay[hidden],
.asset-modal-overlay[hidden] {
  display: none !important;
}

.picker-overlay {
  display: grid;
  align-items: end;
  padding: 14px;
  background: rgba(84, 58, 43, 0.24);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.picker-sheet {
  border-radius: 28px;
  padding: 18px;
}

.picker-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.picker-list {
  display: grid;
  gap: 10px;
  max-height: min(56vh, 460px);
  overflow: auto;
  padding-right: 6px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 94, 74, 0.62) rgba(255, 255, 255, 0.12);
}

.picker-list::-webkit-scrollbar {
  width: 10px;
}

.picker-list::-webkit-scrollbar-track {
  margin: 4px 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.picker-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(166, 127, 97, 0.9), rgba(128, 96, 73, 0.78));
  background-clip: padding-box;
}

.picker-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(176, 136, 104, 0.95), rgba(138, 104, 80, 0.84));
  background-clip: padding-box;
}

.picker-option {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.loading-overlay,
.asset-modal-overlay {
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at center, rgba(255, 237, 220, 0.18), transparent 30%),
    rgba(79, 55, 41, 0.34);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.loading-stage {
  width: min(100%, 420px);
  padding: 34px 24px;
  border-radius: 34px;
  display: grid;
  gap: 22px;
  justify-items: center;
  text-align: center;
}

#wifi-loader {
  --back-color: rgba(188, 122, 80, 0.15);
  --front-color: #bc7a50;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

#wifi-loader svg {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
}

#wifi-loader svg circle {
  position: absolute;
  fill: none;
  stroke-width: 6px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: rotate(-100deg);
  transform-origin: center;
}

#wifi-loader svg circle.back {
  stroke: var(--back-color);
}

#wifi-loader svg circle.front {
  stroke: var(--front-color);
}

#wifi-loader svg.circle-outer {
  height: 86px;
  width: 86px;
}

#wifi-loader svg.circle-outer circle {
  stroke-dasharray: 62.75 188.25;
}

#wifi-loader svg.circle-outer circle.back {
  animation: circle-outer 1.8s ease infinite 0.3s;
}

#wifi-loader svg.circle-outer circle.front {
  animation: circle-outer 1.8s ease infinite 0.15s;
}

#wifi-loader svg.circle-middle {
  height: 60px;
  width: 60px;
}

#wifi-loader svg.circle-middle circle {
  stroke-dasharray: 42.5 127.5;
}

#wifi-loader svg.circle-middle circle.back {
  animation: circle-middle 1.8s ease infinite 0.25s;
}

#wifi-loader svg.circle-middle circle.front {
  animation: circle-middle 1.8s ease infinite 0.1s;
}

#wifi-loader svg.circle-inner {
  height: 34px;
  width: 34px;
}

#wifi-loader svg.circle-inner circle {
  stroke-dasharray: 22 66;
}

#wifi-loader svg.circle-inner circle.back {
  animation: circle-inner 1.8s ease infinite 0.2s;
}

#wifi-loader svg.circle-inner circle.front {
  animation: circle-inner 1.8s ease infinite 0.05s;
}

/* ---------- Page header ---------- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

[data-page="gallery"] .page-header {
  align-items: flex-start;
  margin-bottom: 2px;
}

[data-page="gallery"] .page-header > div:first-child {
  display: grid;
  gap: 2px;
  margin-top: 32px;
}

[data-page="gallery"] .page-header h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
}

.page-header.only-actions {
  justify-content: flex-end;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.header-pill:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.6);
}

/* ---------- Login ---------- */

.login-form {
  padding: 22px;
  border-radius: var(--radius-xl);
  display: grid;
  gap: 16px;
}

.login-error {
  margin: 0;
  color: #c44;
  font-size: 13px;
}

.login-back {
  justify-self: center;
}

/* ---------- Gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.gallery-card {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.28);
}

.gallery-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.gallery-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
}

.gallery-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  color: var(--accent);
}

.gallery-empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 0;
}

.gallery-card-clickable {
  cursor: pointer;
  transition: transform 140ms ease;
}

.gallery-card-clickable:hover {
  transform: scale(1.02);
}

/* ---------- Gallery lightbox ---------- */

.gallery-lightbox-box {
  width: min(100%, 900px);
  border-radius: 28px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 251, 247, 0.52), rgba(255, 248, 241, 0.36));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    var(--shadow);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
}

.gallery-lightbox-close {
  justify-self: end;
}

.gallery-lightbox-media {
  overflow: hidden;
  margin-top: 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.2);
}

.gallery-lightbox-media img {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  display: block;
}

/* ---------- User management ---------- */

.user-detail-modal {
  width: min(100%, 820px);
  max-height: 85vh;
  overflow-y: auto;
}

.user-detail-info {
  margin-bottom: 0;
}

.detail-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
}

.detail-actions .field {
  max-width: 140px;
}

.user-detail-gallery {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pair-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
}

.pair-arrow {
  font-size: 22px;
  color: var(--accent);
  font-weight: 300;
}

.pair-card {
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.28);
}

.pair-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.pair-card-empty {
  min-height: 160px;
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 760px) {
  .pair-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .pair-arrow {
    justify-self: center;
    transform: rotate(90deg);
  }

  .pair-card img {
    height: 140px;
  }
}


@media (max-width: 760px) {
  .gallery-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-section {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .detail-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .detail-actions .field {
    max-width: none;
  }
}

@media (max-width: 520px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }

}

@keyframes circle-outer {
  0%   { stroke-dashoffset: 25; }
  25%  { stroke-dashoffset: 0; }
  65%  { stroke-dashoffset: 301; }
  80%  { stroke-dashoffset: 276; }
  100% { stroke-dashoffset: 276; }
}

@keyframes circle-middle {
  0%   { stroke-dashoffset: 17; }
  25%  { stroke-dashoffset: 0; }
  65%  { stroke-dashoffset: 204; }
  80%  { stroke-dashoffset: 187; }
  100% { stroke-dashoffset: 187; }
}

@keyframes circle-inner {
  0%   { stroke-dashoffset: 9; }
  25%  { stroke-dashoffset: 0; }
  65%  { stroke-dashoffset: 106; }
  80%  { stroke-dashoffset: 97; }
  100% { stroke-dashoffset: 97; }
}

.loading-copy {
  display: grid;
  gap: 8px;
}

.admin-hero {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.hero-actions,
.toolbar-row,
.school-row-actions,
.asset-modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.4);
  color: var(--muted);
}

.admin-sections {
  display: grid;
  gap: 18px;
}

.admin-section {
  border-radius: var(--radius-xl);
  padding: 20px;
}

.section-heading {
  margin-bottom: 16px;
}

.admin-form {
  display: grid;
  gap: 16px;
}

.admin-row {
  display: grid;
  gap: 14px;
}

.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.four-up {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field,
.upload-field {
  display: grid;
  gap: 8px;
}

.field span,
.upload-field span {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.32);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.field input:-webkit-autofill,
.field textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 30px #f5eee7 inset !important;
  -webkit-text-fill-color: var(--text) !important;
}

.school-meta-row {
  align-items: stretch;
}

.field-large input,
.field-large textarea {
  min-height: 156px;
  height: 156px;
  padding: 22px 22px;
  font-size: 18px;
  line-height: 1.4;
}

.field-large input {
  display: block;
  vertical-align: top;
}

.field-large textarea {
  resize: none;
}

#schoolName {
  overflow: hidden;
}

.field-large input::placeholder,
.field-large textarea::placeholder {
  font-size: 18px;
  line-height: 1.4;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.select-shell:focus-within select {
  border-color: var(--line-strong);
}

.select-shell {
  position: relative;
}

.select-shell select {
  appearance: none;
  min-height: 52px;
  padding-right: 42px;
}

.select-caret {
  position: absolute;
  right: 18px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-62%) rotate(45deg);
  pointer-events: none;
}

.upload-grid {
  align-items: start;
}

.asset-uploader input {
  display: none;
}

.asset-card {
  display: grid;
  place-items: center;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 12px 28px rgba(138, 103, 77, 0.08);
  cursor: pointer;
}

.asset-card-button {
  min-width: 136px;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid rgba(188, 122, 80, 0.18);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(202, 136, 90, 0.95), rgba(182, 110, 66, 0.92));
  color: #fff9f3;
  box-shadow: 0 16px 30px rgba(188, 122, 80, 0.22);
  pointer-events: none;
}

.asset-card.has-image {
  padding: 0;
}

.asset-thumb-wrap {
  width: 100%;
  height: 100%;
}

.asset-thumb {
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.asset-modal {
  width: min(100%, 760px);
  border-radius: 28px;
  padding: 20px;
}

.asset-modal-close {
  justify-self: end;
}

.asset-modal-media {
  overflow: hidden;
  margin-top: 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.2);
}

.asset-modal-media img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.asset-modal-actions {
  justify-content: center;
  margin-top: 18px;
}

.clean-list {
  display: grid;
  gap: 12px;
}

.school-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid rgba(124, 86, 60, 0.1);
}

.school-row:first-child {
  border-top: 0;
}

.school-row-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.school-row-copy {
  min-width: 0;
}

.school-row-copy h3,
.school-row-copy p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-list-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 18px;
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.32);
}

.school-list-logo.placeholder,
.mini-preview {
  background: rgba(255, 255, 255, 0.22);
}

.school-row-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.school-row-previews img,
.mini-preview {
  width: 100%;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.school-empty {
  padding: 18px 0;
  color: var(--muted);
}

.user-row {
  grid-template-columns: 1fr auto;
}

@media (max-width: 760px) {
  .user-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .user-row .school-row-actions {
    justify-content: flex-start;
  }
}

@media (min-width: 860px) {
  .studio-app {
    max-width: 520px;
    margin: 0 auto;
  }
}

@media (max-width: 859px) {
  .app-shell,
  .admin-app {
    width: min(100vw - 20px, 100%);
    padding-top: 14px;
  }

  .stage-copy h1 {
    font-size: 30px;
  }
}

@media (max-width: 760px) {
  .admin-hero,
  .toolbar-row,
  .school-row {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .two-up,
  .three-up,
  .four-up {
    grid-template-columns: 1fr;
  }

  .school-row-previews {
    width: 100%;
  }

  .glass-panel,
  .admin-section,
  .picker-sheet,
  .loading-stage,
  .asset-modal,
  .upload-button-wrap,
  .picker-button,
  .login-form {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .field-large input,
  .field-large textarea,
  .asset-thumb {
    height: 148px;
    min-height: 148px;
  }
}

@media (max-width: 520px) {
  .selection-panel,
  .upload-panel,
  .result-frame,
  .admin-section,
  .asset-modal {
    padding: 16px;
    border-radius: 24px;
  }

  .stage-result > .stage-copy,
  .stage-result > .result-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  .stage-copy h1 {
    font-size: 28px;
  }

  .stage-copy h2,
  .admin-hero h1 {
    font-size: 24px;
  }

  .picker-sheet {
    border-radius: 24px;
    padding: 16px;
  }

  .result-state,
  .result-state.image img {
    min-height: 260px;
  }

  .asset-card {
    min-height: 168px;
  }

  .asset-thumb {
    height: 168px;
  }
}

/* ---------- Toggle Switch ---------- */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.toggle-info {
  display: grid;
  gap: 4px;
}

.toggle-info strong {
  font-size: 16px;
  font-weight: 600;
}

.toggle-desc {
  color: var(--muted);
  font-size: 14px;
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(124, 86, 60, 0.18);
  transition: background 200ms ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(24px);
}

/* ---------- Music Player ---------- */

.music-player {
  position: fixed;
  top: 80px;
  right: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(calc(100% - 40px));
  transition: transform 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.music-player.expanded {
  transform: translateX(-12px);
}

.music-toggle {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 250, 244, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  cursor: pointer;
  box-shadow:
    0 4px 16px rgba(128, 89, 63, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.4);
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
  overflow: hidden;
}

.music-toggle:hover {
  border-color: var(--accent);
  box-shadow:
    0 8px 28px rgba(180, 108, 66, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.5);
  transform: scale(1.06);
}

.music-vinyl {
  display: block;
  width: 100%;
  height: 100%;
  animation: vinyl-spin 6s linear infinite;
  animation-play-state: paused;
}

.music-player.playing .music-vinyl {
  animation-play-state: running;
}

@keyframes vinyl-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.music-play-pause {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 250, 244, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--muted);
  cursor: pointer;
  box-shadow:
    0 4px 16px rgba(128, 89, 63, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.4);
  transition: border-color 200ms ease, background 200ms ease, color 200ms ease;
}

.music-player.playing .music-play-pause {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 250, 244, 0.65);
}

.music-play-pause:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 250, 244, 0.65);
}

.music-controls[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .music-toggle,
  .music-play-pause {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

.site-footer {
  text-align: center;
  padding: 12px 0 16px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}
