:root {
  color-scheme: light;
  --bg: #d9f1ff;
  --card: rgba(247, 253, 255, 0.86);
  --line: rgba(91, 188, 255, 0.22);
  --ink: #0a2f57;
  --muted: #447897;
  --accent: #064376;
  --primary: #44aef2;
  --button-orange-top: #65c0f6;
  --button-orange-mid: #44aef2;
  --button-orange-bottom: #2d93d2;
  --button-orange-shadow: rgba(86, 128, 152, 0.2);
  --button-cream-top: rgba(252, 254, 255, 0.94);
  --button-cream-bottom: rgba(233, 243, 249, 0.86);
  --button-cream-ink: #325471;
  --soft-button-bg: rgba(252, 254, 255, 0.92);
  --soft-button-bg-strong: rgba(249, 253, 255, 0.97);
  --soft-button-text: #325471;
  --soft-button-shadow: rgba(93, 136, 163, 0.14);
  --soft-accent-wash: rgba(115, 181, 214, 0.1);
  --soft-accent-border: rgba(115, 181, 214, 0.3);
  --page-glow-left: rgba(210, 232, 247, 0.22);
  --page-glow-right: rgba(210, 232, 247, 0.18);
  --welcome-screen-bg: #d8f1ff;
  --welcome-float-bg: rgba(255, 255, 255, 0.3);
  --welcome-panel-bg: rgba(249, 253, 255, 0.38);
  --welcome-panel-border: rgba(255, 255, 255, 0.68);
  --welcome-panel-shadow: rgba(82, 113, 131, 0.12);
  --floating-button-bg: rgba(248, 252, 255, 0.94);
  --floating-button-text: #325471;
  --floating-button-shadow: rgba(93, 136, 163, 0.18);
  --favorite-active-bg: var(--primary);
  --favorite-active-text: #ffffff;
  --count-pill-bg: rgba(248, 252, 255, 0.9);
  --count-pill-text: #2e4357;
  --count-pill-shadow: rgba(86, 111, 132, 0.08);
  --heart: #ff5f93;
  --shadow: 0 24px 60px rgba(11, 72, 122, 0.18);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --content-width: min(1100px, calc(100vw - 32px));
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

body::before {
  content: none;
}

body.modal-open {
  overflow: hidden;
}

body.welcome-active {
  overflow: hidden;
}

html[data-welcome-state="active"] body {
  overflow: hidden;
}

html[data-welcome-state="dismissed"] .welcome-screen {
  display: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

html[data-current-page="editor"] #galleryPage,
html[data-current-page="editor"] #miiGalleryPage,
html[data-current-page="editor"] #switchPage,
html[data-current-page="editor"] #miiPage,
html[data-current-page="editor"] #garmentPage,
html[data-current-page="editor"] #supportPage,
html[data-current-page="gallery"] #editorPage,
html[data-current-page="gallery"] #miiGalleryPage,
html[data-current-page="gallery"] #switchPage,
html[data-current-page="gallery"] #miiPage,
html[data-current-page="gallery"] #garmentPage,
html[data-current-page="gallery"] #supportPage,
html[data-current-page="mii-gallery"] #editorPage,
html[data-current-page="mii-gallery"] #galleryPage,
html[data-current-page="mii-gallery"] #switchPage,
html[data-current-page="mii-gallery"] #miiPage,
html[data-current-page="mii-gallery"] #garmentPage,
html[data-current-page="mii-gallery"] #supportPage,
html[data-current-page="switch"] #editorPage,
html[data-current-page="switch"] #galleryPage,
html[data-current-page="switch"] #miiGalleryPage,
html[data-current-page="switch"] #miiPage,
html[data-current-page="switch"] #garmentPage,
html[data-current-page="switch"] #supportPage,
html[data-current-page="mii"] #editorPage,
html[data-current-page="mii"] #galleryPage,
html[data-current-page="mii"] #miiGalleryPage,
html[data-current-page="mii"] #switchPage,
html[data-current-page="mii"] #garmentPage,
html[data-current-page="mii"] #supportPage,
html[data-current-page="garment"] #editorPage,
html[data-current-page="garment"] #galleryPage,
html[data-current-page="garment"] #miiGalleryPage,
html[data-current-page="garment"] #switchPage,
html[data-current-page="garment"] #miiPage,
html[data-current-page="garment"] #supportPage,
html[data-current-page="support"] #editorPage,
html[data-current-page="support"] #galleryPage,
html[data-current-page="support"] #miiGalleryPage,
html[data-current-page="support"] #switchPage,
html[data-current-page="support"] #miiPage,
html[data-current-page="support"] #garmentPage {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-glow {
  position: fixed;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.18;
}

.page-glow-left {
  top: -8rem;
  left: -6rem;
  background: var(--page-glow-left);
}

.page-glow-right {
  right: -8rem;
  top: 10rem;
  background: var(--page-glow-right);
}

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  background: var(--welcome-screen-bg);
}

.welcome-gallery {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.welcome-float {
  position: absolute;
  left: var(--float-left, 10%);
  top: var(--float-top, 10%);
  width: var(--float-size, 76px);
  aspect-ratio: 1 / 1;
  padding: 8px;
  border-radius: 24px;
  background: var(--welcome-float-bg);
  box-shadow: 0 20px 44px var(--welcome-panel-shadow);
  backdrop-filter: blur(18px);
  transform: rotate(var(--float-rotate, 0deg));
  opacity: 0.74;
}

.welcome-float img {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  object-fit: cover;
  filter: blur(1.2px) saturate(0.92);
}

.welcome-shell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.welcome-panel {
  width: min(760px, calc(100vw - 56px));
  padding: clamp(32px, 6vw, 48px);
  border: 1px solid var(--welcome-panel-border);
  border-radius: 36px;
  background: var(--welcome-panel-bg);
  box-shadow: 0 30px 80px var(--welcome-panel-shadow);
  backdrop-filter: blur(28px);
}

.welcome-kicker {
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.24rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome-title {
  margin-top: 16px;
  font-size: clamp(2.4rem, 5.5vw, 4.1rem);
  line-height: 0.98;
}

.welcome-copy {
  margin-top: 20px;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.28rem);
  font-weight: 700;
}

.welcome-start-button {
  min-width: 240px;
  margin-top: 40px;
  padding: 18px 34px;
  border: 0;
  border-radius: 22px;
  background: var(--primary);
  color: #f7fdff;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 900;
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(237, 252, 255, 0.42),
    0 16px 30px var(--button-orange-shadow);
}

.welcome-start-button:hover {
  transform: translateY(-1px);
}

.shell-header,
.app-shell {
  position: relative;
  z-index: 1;
  width: var(--content-width);
  margin: 0 auto;
}

.admin-shell {
  padding: 28px 0 44px;
}

.shell-header {
  padding-top: 20px;
}

.nav-pill {
  display: flex;
  justify-content: center;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 28px rgba(74, 111, 170, 0.12);
  backdrop-filter: blur(18px);
}

.page-tabs,
.gallery-card-footer,
.action-bar,
.chip-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-tabs,
.chip-row {
  flex-wrap: wrap;
}

.tab-button,
.mini-chip,
.secondary-button,
.primary-button,
.icon-action {
  border: 0;
  border-radius: 18px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease, filter 0.18s ease;
}

.tab-button,
.mini-chip {
  padding: 10px 16px;
  background: var(--soft-button-bg);
  color: var(--button-cream-ink);
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 8px 18px var(--soft-button-shadow);
}

.tab-button.active,
.mini-chip.active {
  background: var(--primary);
  color: #fff;
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(237, 252, 255, 0.35),
    0 12px 22px var(--button-orange-shadow);
}

html[data-current-page] .page-tabs .tab-button {
  background: var(--soft-button-bg);
  color: var(--button-cream-ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 8px 18px var(--soft-button-shadow);
}

html[data-current-page="editor"] #editorTabBtn,
html[data-current-page="gallery"] #galleryTabBtn,
html[data-current-page="mii-gallery"] #miiGalleryTabBtn,
html[data-current-page="switch"] #switchTabBtn,
html[data-current-page="mii"] #miiTabBtn,
html[data-current-page="garment"] #garmentTabBtn,
html[data-current-page="support"] #supportTabBtn {
  background: var(--primary);
  color: #fff;
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(237, 252, 255, 0.35),
    0 12px 22px var(--button-orange-shadow);
}

.garment-direct-mount {
  display: block;
  min-width: 0;
}

#sortFilterBar .mini-chip {
  background: var(--soft-button-bg);
  color: var(--button-cream-ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 8px 18px var(--soft-button-shadow);
}

#sortFilterBar .mini-chip.active {
  background: var(--primary);
  color: #fff;
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(237, 252, 255, 0.35),
    0 12px 22px var(--button-orange-shadow);
}

.app-shell {
  padding: 14px 0 32px;
}

.page-section {
  display: grid;
  gap: 18px;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.support-layout {
  display: grid;
}

.surface-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.generator-card,
.preview-card,
.support-card {
  padding: 12px;
}

.section-heading {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.section-heading-tight {
  margin-bottom: 10px;
}

.preview-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.preview-tip {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.switch-eyebrow-note {
  margin-left: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(88, 112, 144, 0.92);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1;
}

h2 {
  font-size: 1.1rem;
  line-height: 1.2;
}

h3 {
  font-size: 1rem;
}

.section-copy,
.config-row p,
.summary-label,
.gallery-card-date,
.gallery-card-meta,
.inline-notice,
.support-panel p {
  color: var(--muted);
}

.section-copy,
.config-row p {
  font-size: 0.9rem;
  line-height: 1.45;
}

.upload-dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 120px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--soft-button-bg-strong);
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 14px 30px var(--soft-button-shadow);
  overflow: hidden;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.upload-dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--soft-accent-wash);
  pointer-events: none;
}

.upload-dropzone:hover {
  transform: translateY(-1px);
  border-color: var(--soft-accent-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 18px 36px var(--soft-button-shadow);
}

.upload-dropzone strong,
.upload-dropzone span,
.upload-dropzone svg {
  position: relative;
  z-index: 1;
}

.upload-dropzone strong {
  color: var(--soft-button-text);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.upload-dropzone span {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.upload-dropzone input {
  display: none;
}

.upload-icon {
  width: 44px;
  height: 44px;
  stroke: var(--primary);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 8px 18px var(--soft-button-shadow));
}

.form-stack,
.config-card,
.config-row,
.field,
.preview-meta,
.support-grid,
.filter-stack {
  display: grid;
  gap: 8px;
}

.compact-stack {
  margin-top: 10px;
}

.field-grid {
  display: grid;
  gap: 8px;
}

.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field span {
  font-size: 0.82rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 9px 12px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(137, 183, 243, 0.85);
  box-shadow: 0 0 0 4px rgba(137, 183, 243, 0.2);
}

.config-card {
  padding: 12px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.6);
}

.compact-config-card {
  gap: 10px;
}

.config-row {
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
  align-items: end;
  gap: 12px;
}

.config-row-column {
  grid-template-columns: 1fr;
}

.compact-field {
  align-items: start;
}

.compact-field span {
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1;
}

.slider-field input[type="range"] {
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  height: 28px;
  background: transparent;
}

.slider-field input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(205, 222, 246, 0.95) 0%, rgba(222, 233, 248, 0.95) 100%);
}

.slider-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -10.5px;
  border: 1px solid rgba(126, 161, 209, 0.35);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #edf5ff 100%);
  box-shadow: 0 6px 16px rgba(74, 111, 170, 0.18);
}

.slider-field input[type="range"]::-moz-range-track {
  height: 7px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(205, 222, 246, 0.95) 0%, rgba(222, 233, 248, 0.95) 100%);
}

.slider-field input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(126, 161, 209, 0.35);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #edf5ff 100%);
  box-shadow: 0 6px 16px rgba(74, 111, 170, 0.18);
}

.slider-field input[type="range"]::-moz-range-progress {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #79b0ff 0%, #5d9af2 100%);
}

.inline-slider-field {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.inline-slider-field span {
  justify-self: end;
  min-width: 72px;
  text-align: right;
}

.block-slider-field {
  gap: 8px;
}

.block-slider-field span {
  display: block;
  min-height: 1em;
}

.single-status-card,
.preview-meta > div {
  padding: 10px 12px;
  margin-top: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px rgba(20, 16, 10, 0.06);
}

.support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.support-qr-card {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(20, 16, 10, 0.06);
}

.support-qr-title {
  font-weight: 700;
}

.support-qr-placeholder {
  display: grid;
  place-items: center;
  min-height: 240px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.support-qr-button {
  width: 100%;
  padding: 0;
  border: 0;
  cursor: zoom-in;
}

.support-qr-placeholder img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
}

.support-qr-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.support-qr-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 13, 19, 0.7);
}

.support-qr-modal-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(92vw, 560px);
  padding: 18px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px rgba(17, 16, 22, 0.28);
}

.support-qr-modal-dialog img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
}

.support-qr-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(248, 252, 255, 0.94);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 14px 28px rgba(47, 80, 116, 0.18);
  backdrop-filter: blur(14px);
}

.support-qr-modal-tip {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.switch-page-layout {
  display: grid;
  gap: 14px;
}

.mii-page-layout {
  display: grid;
  gap: 14px;
}

.mii-connect-card,
.mii-tool-card,
.mii-sav-card {
  padding: 12px;
}

.mii-control-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.05fr) minmax(220px, 0.75fr);
  gap: 12px;
  align-items: stretch;
}

.mii-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.mii-action-row > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  text-align: center;
  text-decoration: none;
}

.mii-action-row #miiLoadSavBtn {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 74%, white) 0%, color-mix(in srgb, var(--primary) 88%, white) 100%);
}

.mii-tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
}

.mii-main-column {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 14px;
  min-width: 0;
}

.mii-top-row {
  display: grid;
  min-width: 0;
}

.mii-pending-card {
  min-height: 100%;
}

.mii-tool-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.mii-attributes-card {
  grid-column: 1 / -1;
  min-height: 0;
}

.mii-share-card {
  grid-column: 1 / -1;
}

.mii-pending-card {
  align-content: start;
}

.mii-mini-actions,
.mii-share-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mii-mini-actions > * {
  flex: 1 1 0;
  min-height: 44px;
}

.mii-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 6px;
  max-height: 170px;
  overflow: auto;
  padding-right: 2px;
}

.mii-slot-chip {
  width: 100%;
  min-width: 0;
  display: inline-grid;
  gap: 2px;
  min-height: 34px;
  padding: 5px 8px;
  border: 0;
  border-radius: 14px;
  color: var(--button-cream-ink);
  background: var(--soft-button-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 8px 18px var(--soft-button-shadow);
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.mii-slot-chip:hover {
  transform: translateY(-1px);
}

.mii-slot-chip.active {
  color: #ffffff;
  background: var(--primary);
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(237, 252, 255, 0.35),
    0 12px 22px var(--button-orange-shadow);
}

.mii-slot-chip span,
.mii-share-item span {
  color: inherit;
  opacity: 0.88;
  font-size: 0.7rem;
  font-weight: 800;
}

.mii-slot-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.mii-file-drop {
  position: relative;
  display: inline-grid;
  gap: 4px;
  justify-items: center;
  justify-self: stretch;
  min-width: 0;
  padding: 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 22px var(--soft-button-shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.mii-file-drop:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
}

.mii-file-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.mii-file-drop span {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.mii-share-submit-button {
  flex-basis: 100%;
}

.mii-publish-dialog {
  width: min(96vw, 1280px);
  max-width: 1280px;
  grid-template-columns: 1fr;
}

.mii-publish-upload-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mii-publish-upload-card {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.mii-camera-input {
  pointer-events: none;
}

.mii-publish-upload-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
}

.mii-publish-drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 128px;
  padding: 12px;
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px var(--surface-border);
  overflow: hidden;
}

.mii-publish-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.mii-publish-drop img {
  width: 100%;
  max-height: 108px;
  object-fit: contain;
  border-radius: 12px;
}

.mii-publish-drop span {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 900;
}

.mii-publish-input-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.mii-publish-source-chip[data-open-file-input$="CameraInput"] {
  display: none;
}

.mii-publish-source-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 8px;
  font-size: 0.82rem;
  border: 0;
  cursor: pointer;
}

.mii-pending-box {
  min-width: 0;
}

.mii-pending-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px var(--surface-border);
}

.mii-pending-item img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
}

.mii-pending-item div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.mii-pending-item strong,
.mii-pending-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mii-pending-item span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.mii-want-button {
  min-width: 0;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 16px;
  color: #ffffff;
  background: var(--primary);
  box-shadow:
    inset 0 1px 0 rgba(237, 252, 255, 0.35),
    0 10px 20px var(--button-orange-shadow);
  font-weight: 900;
}

.mii-want-button.is-disabled,
.mii-detail-want-button.is-disabled {
  opacity: 0.58;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.mii-gallery-card .gallery-card-footer {
  grid-template-columns: 38px minmax(30px, 42px) minmax(74px, 1fr);
  gap: 7px;
  min-width: 0;
  overflow: visible;
  padding-top: 2px;
}

.mii-gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
}

.mii-gallery-card {
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
}

.mii-gallery-card .gallery-card-preview {
  border-radius: 14px;
}

.mii-gallery-card .gallery-card-body {
  gap: 5px;
}

.mii-gallery-card .gallery-card-title {
  font-size: 0.96rem;
}

.mii-gallery-card .gallery-card-meta {
  display: -webkit-box;
  min-height: 1.95em;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mii-gallery-card .icon-action,
.mii-gallery-card .favorite-action {
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: 14px;
  background: var(--soft-button-bg-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 10px 20px var(--soft-button-shadow);
  transform: translateY(-2px);
}

.mii-gallery-card .gallery-favorite-count {
  height: 38px;
  min-width: 30px;
  padding: 0 4px;
  font-size: 0.78rem;
  background: var(--count-pill-bg);
  box-shadow:
    inset 0 0 0 1px rgba(16, 35, 63, 0.05),
    0 10px 20px var(--count-pill-shadow);
  transform: translateY(-2px);
}

.mii-gallery-card .mii-want-button {
  min-height: 38px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 6px;
  border-radius: 14px;
  font-size: 0.78rem;
  box-shadow:
    inset 0 1px 0 rgba(237, 252, 255, 0.35),
    0 10px 20px var(--button-orange-shadow);
  transform: translateY(-2px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mii-share-detail-actions .mii-detail-want-button {
  grid-column: 1 / -1;
  min-width: min(100%, 340px);
  justify-self: stretch;
}

.mii-gallery-qr-figure {
  max-width: min(100%, 560px);
  justify-self: center;
  width: 100%;
}

.mii-gallery-compact-detail {
  display: grid;
  grid-template-columns: minmax(220px, 1fr);
  gap: 10px;
  align-items: start;
}

.mii-gallery-detail-images,
.mii-share-save-card,
.mii-gallery-meta-card {
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px var(--surface-border);
}

.mii-gallery-detail-images {
  margin: 0;
}

.mii-gallery-detail-images {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.mii-gallery-detail-figure {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  align-content: start;
}

.mii-gallery-detail-figure img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px var(--surface-border);
}

.mii-gallery-qr-figure img {
  display: block;
  aspect-ratio: 16 / 10;
  min-height: 180px;
  object-fit: contain;
}

.mii-gallery-qr-loading {
  display: grid;
  place-items: center;
  min-height: 160px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px var(--surface-border);
}

.mii-gallery-detail-figure figcaption {
  color: var(--muted);
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.15;
  font-weight: 900;
}

.mii-share-save-card {
  justify-items: center;
  text-align: center;
}

.mii-share-save-preview {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 220px;
  padding: 8px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(28, 28, 28, 0.14);
}

.mii-share-save-preview img,
.mii-share-save-preview canvas {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.mii-share-qr-placeholder {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.mii-share-qr-caption,
.mii-share-qr-copy {
  margin: 0;
}

.mii-share-qr-copy {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.mii-share-link-chip {
  text-decoration: none;
}

.mii-gallery-meta-card {
  min-width: 0;
}

.mii-gallery-compact-detail .mii-share-detail-info {
  gap: 6px;
  padding: 10px;
  border-radius: 18px;
}

.mii-gallery-compact-detail .mii-share-detail-row {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  padding: 5px 0;
}

.mii-gallery-compact-detail .mii-share-detail-desc {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.mii-share-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.mii-share-filter-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) repeat(3, minmax(104px, 0.8fr));
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.mii-share-filter-grid select,
.mii-share-toggle {
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-radius: 16px;
  padding: 8px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 1px var(--surface-border);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 850;
}

.mii-share-filter-grid select {
  appearance: auto;
}

.mii-share-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  overflow: hidden;
}

.mii-share-toggle span {
  line-height: 1.2;
}

.mii-share-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.mii-share-page-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  min-width: 58px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: inset 0 0 0 1px var(--surface-border);
}

.mii-share-toolbar {
  justify-content: center;
  align-items: center;
}

.mii-share-page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: inset 0 0 0 1px var(--surface-border);
}

.mii-share-page-jump input {
  width: 72px;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  text-align: center;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.86);
}

.mii-share-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.mii-share-item {
  display: grid;
  gap: 8px;
  padding: 9px;
  border-radius: 18px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--surface-border);
  min-width: 0;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.mii-share-main {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.mii-share-item:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px var(--surface-border), 0 10px 22px var(--soft-button-shadow);
}

.mii-share-item img {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.7);
}

.mii-share-item div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.mii-share-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mii-share-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
}

.mii-share-detail-dialog {
  position: relative;
  z-index: 1;
  justify-self: center;
  align-self: center;
  width: min(980px, calc(100vw - 40px));
  max-height: min(88vh, 780px);
  overflow: auto;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  background: linear-gradient(180deg, rgba(250, 253, 255, 0.99) 0%, rgba(236, 245, 255, 0.98) 100%);
  box-shadow: 0 30px 76px rgba(22, 49, 86, 0.34);
  backdrop-filter: blur(18px);
}

.mii-share-detail-modal .confirm-modal-backdrop {
  background: rgba(15, 25, 42, 0.62);
  backdrop-filter: blur(8px);
}

.mii-share-detail-content {
  display: grid;
  gap: 14px;
}

.mii-share-detail-header h2 {
  margin: 2px 0 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.mii-share-detail-body {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(300px, 1.05fr);
  gap: 14px;
  align-items: start;
}

.mii-apply-floating {
  margin-top: 8px;
}

.mii-share-detail-gallery,
.mii-share-detail-info {
  display: grid;
  gap: 10px;
}

.mii-share-detail-main-image {
  display: grid;
  place-items: center;
  min-height: 260px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 0 0 1px var(--surface-border);
  overflow: hidden;
}

.mii-share-detail-main-image img {
  display: block;
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.mii-share-detail-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
}

.mii-share-detail-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 4px;
  border: 0;
  border-radius: 16px;
  background: var(--soft-button-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 8px 18px var(--soft-button-shadow);
  cursor: pointer;
}

.mii-share-detail-thumb.active {
  background: var(--primary);
}

.mii-share-detail-thumb img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
}

.mii-share-detail-info {
  padding: 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px var(--surface-border);
}

.mii-share-detail-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--surface-border) 72%, transparent);
}

.mii-share-detail-row b {
  color: var(--muted);
  font-size: 0.78rem;
}

.mii-share-detail-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.mii-share-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
}

.mii-share-detail-tags .mini-chip {
  padding: 7px 10px;
  font-size: 0.78rem;
}

.mii-share-detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 6px;
}

.mii-share-detail-actions > * {
  width: 100%;
}

.mii-share-detail-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.5;
}

.tomodachi-instruction-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 18px;
}

#tomodachiInstructionModal {
  z-index: 34;
}

.tomodachi-instruction-content {
  display: grid;
  gap: 12px;
  margin-top: 8px;
  color: #78350f;
  font-weight: 760;
  line-height: 1.35;
}

.tomodachi-instruction-heading {
  display: grid;
  gap: 3px;
  color: #9a4300;
}

.tomodachi-instruction-heading strong {
  font-size: 1.2rem;
  font-weight: 950;
}

.tomodachi-instruction-heading span {
  font-size: 0.82rem;
  font-weight: 800;
}

.tomodachi-instruction-sections {
  display: grid;
  gap: 10px;
}

.tomodachi-instruction-section {
  display: grid;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  padding: 10px 12px;
  border-left: 5px solid #fbbf24;
  border-radius: 0 14px 14px 0;
  background: rgba(254, 243, 199, 0.72);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.16);
}

.tomodachi-instruction-section.is-subsection {
  width: max-content;
  padding: 3px 0 0 8px;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tomodachi-instruction-section h3 {
  margin: 0;
  color: #92400e;
  font-size: 1.15rem;
  font-weight: 950;
}

.tomodachi-instruction-section.is-subsection h3 {
  font-size: 1.02rem;
}

.tomodachi-instruction-section table {
  width: 100%;
  border-collapse: collapse;
}

.tomodachi-instruction-section tr {
  border-bottom: 1px solid rgba(251, 146, 60, 0.34);
}

.tomodachi-instruction-section tr:last-child {
  border-bottom: 0;
}

.tomodachi-instruction-section td {
  padding: 3px 0;
  vertical-align: middle;
}

.tomodachi-instruction-section td:first-child {
  width: 118px;
  padding-right: 22px;
  color: #b45309;
  font-size: 0.86rem;
  font-weight: 950;
  white-space: nowrap;
}

.tomodachi-instruction-section td:last-child {
  min-width: 0;
  color: #451a03;
  font-size: 0.95rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.tomodachi-instruction-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.1em;
}

.tomodachi-instruction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  align-items: start;
}

.tomodachi-instruction-grid.depth-0 {
  grid-template-columns: 1fr;
  gap: 10px;
}

.tomodachi-instruction-grid.depth-1 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.tomodachi-instruction-group,
.tomodachi-instruction-chip {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 0 0 1px var(--surface-border);
}

.tomodachi-instruction-group {
  background: rgba(255, 255, 255, 0.58);
}

.tomodachi-instruction-group h3,
.tomodachi-instruction-chip h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.15;
  font-weight: 900;
}

.tomodachi-instruction-chip > div {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 900;
}

.tomodachi-instruction-group > div,
.tomodachi-instruction-chip > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tomodachi-color-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tomodachi-color-value em {
  font-style: normal;
  color: #451a03;
  font-size: 0.9rem;
}

.tomodachi-color-value i {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(16, 35, 63, 0.16);
}

.tomodachi-instruction-subsections {
  display: grid;
  gap: 8px;
}

.tomodachi-check-list {
  display: grid;
  gap: 6px;
}

.tomodachi-check-list span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #451a03;
  font-size: 0.9rem;
  font-weight: 850;
}

.tomodachi-check-list i {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: #fffaf0;
  box-shadow: inset 0 0 0 2px rgba(146, 64, 14, 0.42);
}

.tomodachi-check-list .checked i {
  background: #f59e0b;
  box-shadow: inset 0 0 0 3px #fff7ed, inset 0 0 0 5px #f59e0b;
}

.tomodachi-personality-list {
  display: grid;
  gap: 7px;
}

.tomodachi-personality-row {
  display: grid;
  grid-template-columns: 54px 34px max-content 34px;
  gap: 8px;
  align-items: center;
}

.tomodachi-personality-row b,
.tomodachi-personality-row span {
  font-size: 0.82rem;
  font-weight: 850;
}

.tomodachi-personality-row span {
  color: #78716c;
}

.tomodachi-personality-row > div {
  display: inline-flex;
  gap: 3px;
}

.tomodachi-personality-row i {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  opacity: 0.72;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.tomodachi-personality-row i.active {
  opacity: 1;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(146, 64, 14, 0.18);
}

.mii-empty-card {
  display: grid;
  grid-column: 1 / -1;
  min-height: 88px;
  place-items: center;
  padding: 18px;
  border-radius: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--surface-border);
}

.mii-empty-card.wide {
  width: 100%;
  min-height: 104px;
  justify-self: stretch;
  white-space: nowrap;
}

.mii-attribute-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.mii-attr-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 16px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--surface-border);
}

.mii-attr-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.86rem;
}

.mii-attr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.mii-attr-field {
  display: grid;
  gap: 3px;
}

.mii-attr-field span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.mii-attr-field input,
.mii-attr-field select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border: 0;
  border-radius: 12px;
  padding: 6px 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px var(--surface-border);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
}

.mii-sav-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.switch-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.18fr);
  gap: 14px;
  align-items: start;
}

.switch-connect-card,
.switch-source-card,
.switch-target-card,
.switch-settings-card {
  padding: 12px;
}

.switch-connect-shell,
.switch-submit-panel,
.switch-source-meta,
.switch-action-row,
.switch-submit-actions {
  display: grid;
  gap: 10px;
}

.switch-connect-shell {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.switch-connect-main {
  display: grid;
  gap: 8px;
}

.switch-connect-status-card,
.switch-connect-input-card,
.switch-target-item,
.switch-target-empty,
.switch-submit-panel {
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(20, 16, 10, 0.06);
}

.switch-connect-status-card,
.switch-connect-input-card,
.switch-submit-panel,
.switch-target-empty {
  padding: 12px;
}

.switch-connect-status-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 0;
  padding-top: 14px;
  padding-bottom: 14px;
}

.switch-connect-input-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.switch-connect-field {
  gap: 6px;
}

.switch-check-button {
  min-width: 0;
}

.switch-connect-status-card strong,
.switch-submit-meta strong,
.switch-source-meta strong {
  font-size: 1rem;
}

#switchConnectionLabel,
#miiConnectionLabel {
  display: flex;
  align-items: center;
  min-height: 24px;
}

#switchConnectionLabel.is-connected,
#miiConnectionLabel.is-connected {
  color: #2b8a57;
}

#switchConnectionLabel.is-disconnected,
#miiConnectionLabel.is-disconnected {
  color: #d1536c;
}

.switch-inline-copy {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

#switchConnectionHint:empty {
  display: none;
}

.switch-action-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
}

.switch-action-row > * {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding-inline: 10px;
  font-size: 0.88rem;
  line-height: 1.15;
}

.switch-source-preview {
  margin-top: 2px;
}

.switch-source-preview-shell {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  background:
    linear-gradient(45deg, #dfe9f7 25%, transparent 25%),
    linear-gradient(-45deg, #dfe9f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dfe9f7 75%),
    linear-gradient(-45deg, transparent 75%, #dfe9f7 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
}

.switch-source-preview-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.switch-source-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(4px);
}

.switch-source-placeholder span,
.switch-target-empty span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.38;
}

.switch-target-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 92px;
  text-align: center;
}

.switch-target-empty strong {
  display: inline-block;
  text-align: center;
  white-space: nowrap;
}

.switch-target-empty span {
  display: block;
  max-width: 28em;
}

.switch-target-item.active {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--primary) 18%, #fff 82%) 0%,
    color-mix(in srgb, var(--primary) 8%, #fff 92%) 100%
  );
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--primary) 58%, transparent),
    0 14px 30px var(--button-orange-shadow);
}

.switch-target-body {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.switch-target-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.switch-target-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch-target-head span,
.switch-target-body code {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.switch-target-head span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.switch-source-meta {
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.switch-source-meta > div {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px rgba(20, 16, 10, 0.05);
}

.switch-search-bar input {
  min-height: 42px;
  border-radius: 16px;
}

.switch-chip-row {
  margin-top: 8px;
}

#switchTextureCategoryBar {
  gap: 8px 10px;
}

#switchTextureCategoryBar .mini-chip {
  min-height: 42px;
  padding-inline: 16px;
  border-radius: 999px;
}

#switchTextureCategoryBar .mini-chip.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 10px 22px var(--button-orange-shadow);
}

.switch-target-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 10px;
}

.switch-target-item {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 8px 12px;
  border: 0;
  text-align: left;
  border-radius: 16px;
  color: var(--soft-button-text);
  background: rgba(255, 255, 255, 0.76);
  box-shadow:
    inset 0 0 0 1px rgba(112, 159, 196, 0.13),
    0 8px 16px var(--soft-button-shadow);
}

.switch-target-item .switch-target-body {
  display: flex;
  align-items: center;
  min-height: 100%;
  width: 100%;
}

.switch-target-item .switch-target-body strong {
  color: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.15;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.switch-tone-orange {
  background: linear-gradient(160deg, #ffdfb0 0%, #ffab69 100%);
}

.switch-tone-pink {
  background: linear-gradient(160deg, #ffd4ea 0%, #ff8ebe 100%);
}

.switch-tone-blue {
  background: linear-gradient(160deg, #d7e8ff 0%, #7cb4ff 100%);
}

.switch-tone-gold {
  background: linear-gradient(160deg, #fff4bf 0%, #f5be58 100%);
}

.switch-tone-green {
  background: linear-gradient(160deg, #daf8da 0%, #74cd8e 100%);
}

.switch-tone-purple {
  background: linear-gradient(160deg, #e7ddff 0%, #ab91ff 100%);
}

.switch-target-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow:
    inset 0 0 0 1px rgba(20, 16, 10, 0.06),
    0 12px 24px var(--soft-button-shadow);
}

.switch-target-detail-preview {
  flex: 0 0 72px;
  position: relative;
  overflow: hidden;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.switch-target-detail-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.switch-target-detail-preview:not(.is-fallback) {
  background: rgba(255, 255, 255, 0.46);
}

.switch-target-detail-body {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
}

.switch-target-detail-copy {
  display: flex;
  min-height: 72px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.switch-target-detail-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.98rem;
}

.switch-target-detail-pill,
.switch-target-detail-body code {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.switch-target-detail-pill {
  justify-self: end;
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, #fff 88%);
  color: var(--soft-button-text);
  font-weight: 700;
  white-space: nowrap;
}

.switch-target-hint-text {
  width: 100%;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  text-align: center;
}

.switch-form-stack {
  margin-top: 2px;
}

.switch-credit {
  margin: 2px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.editor-credit {
  margin: 10px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.mii-gallery-credit {
  margin: 14px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.45;
}

.switch-submit-panel {
  margin-top: 8px;
}

.switch-submit-floating {
  position: sticky;
  bottom: 14px;
  z-index: 16;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  align-items: center;
  gap: 12px;
  width: min(760px, calc(100vw - 28px));
  margin: 18px auto 0;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: color-mix(in srgb, var(--card) 86%, #fff 14%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 18px 38px rgba(61, 102, 134, 0.18);
  backdrop-filter: blur(18px);
}

.switch-submit-floating .inline-notice {
  grid-column: 1 / -1;
  margin: 0;
}

.switch-submit-actions {
  grid-template-columns: 1fr;
}

.switch-submit-actions > * {
  width: 100%;
  min-width: 0;
}

.switch-submit-actions .primary-button:disabled,
.switch-submit-actions .primary-button.is-disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: saturate(0.72);
}

.switch-scan-status.success {
  color: #2f6fc9;
}

.switch-scan-status.error {
  color: #d1536c;
}

.gallery-press-menu {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: end center;
  padding: 18px;
}

.gallery-press-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 25, 42, 0.28);
}

.gallery-press-sheet {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  width: min(92vw, 320px);
}

.gallery-press-action,
.gallery-press-cancel {
  min-height: 50px;
  border: 0;
  border-radius: 20px;
  font-size: 0.96rem;
  font-weight: 800;
  color: #f7fdff;
  text-shadow: 0 1px 0 rgba(9, 73, 118, 0.3);
}

.gallery-press-action {
  background: var(--primary);
  box-shadow:
    inset 0 1px 0 rgba(227, 251, 255, 0.4),
    0 14px 26px var(--button-orange-shadow);
}

.gallery-press-action.danger {
  background: #d95b6a;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 244, 0.45),
    0 14px 26px rgba(189, 64, 82, 0.2);
}

.gallery-press-cancel {
  background: var(--soft-button-bg);
  color: var(--soft-button-text);
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 14px 26px var(--soft-button-shadow);
}

.switch-scan-dialog {
  width: min(92vw, 560px);
}

.switch-scan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.switch-scan-close {
  position: absolute;
  flex: 0 0 auto;
}

.switch-scan-video-shell {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 50%, rgba(124, 180, 255, 0.1), transparent 60%),
    rgba(214, 231, 255, 0.44);
  box-shadow: inset 0 0 0 1px rgba(20, 16, 10, 0.06);
}

.switch-scan-video {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  background: transparent;
}

.switch-scan-video.is-live {
  display: block;
}

.switch-scan-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  background: rgba(247, 251, 255, 0.44);
  backdrop-filter: blur(10px);
  z-index: 1;
}

.switch-scan-video.is-live + .switch-scan-empty {
  display: none;
}

.switch-scan-empty span,
.switch-scan-status {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.switch-scan-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.switch-upload-qr-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.switch-upload-qr-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
}

#reviewDetailModal {
  z-index: 22;
}

#reviewConfirmModal {
  z-index: 28;
}

#miiImportPasswordModal {
  z-index: 30;
}

body.review-confirm-open #reviewDetailModal {
  pointer-events: none;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 25, 42, 0.42);
}

.confirm-modal-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  justify-self: center;
  align-self: center;
  gap: 12px;
  width: min(420px, calc(100vw - 40px));
  padding: 22px 20px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.97) 0%, rgba(230, 241, 255, 0.95) 100%);
  box-shadow: 0 24px 60px rgba(51, 87, 145, 0.2);
  backdrop-filter: blur(24px);
}

.confirm-modal-dialog.mii-publish-dialog {
  width: min(96vw, 1280px);
  max-width: 1280px;
  grid-template-columns: 1fr;
}

.confirm-modal-dialog h2 {
  margin: 0;
  font-size: 1.26rem;
}

.confirm-modal-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 700;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.back-to-top {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 18px;
  background: var(--floating-button-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 16px 30px var(--floating-button-shadow);
  color: var(--floating-button-text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.floating-tools {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.floating-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 18px;
  background: var(--floating-button-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 16px 30px var(--floating-button-shadow);
  color: var(--floating-button-text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.floating-tool-button:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 20px 34px var(--floating-button-shadow);
}

.floating-tool-button:active {
  transform: translateY(1px);
}

.floating-tool-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.back-to-top:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 20px 34px var(--floating-button-shadow);
}

.back-to-top:active {
  transform: translateY(1px);
}

.back-to-top-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.theme-panel {
  position: fixed;
  right: max(82px, calc(env(safe-area-inset-right) + 82px));
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
  z-index: 19;
}

.theme-panel-card {
  width: min(280px, calc(100vw - 110px));
  padding: 16px 16px 14px;
  border-radius: 22px;
  background: var(--floating-button-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 18px 34px var(--floating-button-shadow);
  backdrop-filter: blur(16px);
}

.theme-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--floating-button-text);
}

.theme-panel-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 12px;
  background: var(--soft-button-bg);
  color: var(--floating-button-text);
  font-size: 1.1rem;
  line-height: 1;
}

.theme-panel-field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.theme-color-picker-field {
  margin-top: 12px;
}

.theme-panel-field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.theme-color-picker {
  width: 100%;
  height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft-button-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    0 10px 20px var(--soft-button-shadow);
}

.theme-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.theme-color-picker::-webkit-color-swatch {
  border: 0;
  border-radius: 12px;
}

.theme-color-picker::-moz-color-swatch {
  border: 0;
  border-radius: 12px;
}

.theme-panel-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.action-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.secondary-button,
.primary-button {
  min-height: 42px;
  padding: 0 14px;
  font-weight: 800;
  color: #f7fdff;
}

.secondary-button {
  background: var(--soft-button-bg);
  color: var(--soft-button-text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 10px 20px var(--soft-button-shadow);
}

.primary-button {
  background: var(--primary);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 10px 20px var(--button-orange-shadow);
}

#clearImageBtn,
#resetEditorBtn {
  background: var(--soft-button-bg);
  color: var(--soft-button-text);
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 10px 20px var(--soft-button-shadow);
}

.preview-stage {
  min-height: 420px;
}

.canvas-shell {
  position: relative;
  overflow: hidden;
  width: 100%;
  border-radius: 22px;
  background:
    linear-gradient(45deg, #dfe9f7 25%, transparent 25%),
    linear-gradient(-45deg, #dfe9f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dfe9f7 75%),
    linear-gradient(-45deg, transparent 75%, #dfe9f7 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.canvas-shell.is-dragging {
  cursor: grabbing;
}

.canvas-shell.is-freeform-erase-mode,
.canvas-shell.is-freeform-erasing {
  cursor: crosshair;
}

.canvas-shell.is-freeform-add-point-mode {
  cursor: copy;
}

.canvas-shell {
  touch-action: none;
}

.freeform-erase-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.freeform-erase-overlay path {
  fill: color-mix(in srgb, var(--primary) 18%, transparent);
  stroke: var(--primary);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 14px color-mix(in srgb, var(--primary) 30%, transparent));
}

.freeform-erase-handle {
  fill: #fff;
  stroke: var(--primary);
  stroke-width: 2;
  filter: drop-shadow(0 4px 8px rgba(20, 58, 98, 0.2));
}

.freeform-erase-handle.active {
  fill: var(--primary);
  stroke: #fff;
}

.freeform-erase-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: var(--soft-button-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 10px 20px var(--soft-button-shadow);
}

.freeform-mobile-slot {
  display: contents;
}

.freeform-erase-field span {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  max-width: 100%;
  min-height: 2.7em;
}

.freeform-erase-field .secondary-button {
  min-height: 36px;
  padding-inline: 12px;
  white-space: nowrap;
}

.freeform-erase-field .secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.freeform-erase-field .secondary-button.active {
  background: var(--primary);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 12px 22px var(--button-orange-shadow);
}

.freeform-erase-field .freeform-apply-button {
  background: var(--primary);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    0 14px 26px var(--button-orange-shadow);
}

.large-canvas {
  aspect-ratio: 1 / 1;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(4px);
}

.gallery-header {
  display: grid;
  gap: 10px;
}

.gallery-header .section-heading {
  margin-bottom: 0;
}

.gallery-search-tip {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.search-bar input {
  min-height: 54px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
}

.admin-card {
  padding: 20px;
}

.admin-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 2px 0;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-count-bar {
  margin-top: 16px;
}

.admin-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow:
    inset 0 0 0 1px rgba(20, 16, 10, 0.05),
    0 14px 28px rgba(86, 122, 182, 0.06);
}

.admin-search-bar {
  flex: 1 1 auto;
}

.admin-search-row > .secondary-button {
  min-width: 92px;
}

.admin-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(245, 249, 255, 0.72) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(20, 16, 10, 0.05),
    0 16px 30px rgba(86, 122, 182, 0.08);
}

.admin-batch-bar > * {
  min-width: 0;
}

.admin-select-all,
.admin-select-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 249, 255, 0.88) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(27, 49, 84, 0.08),
    0 10px 24px rgba(73, 108, 162, 0.1);
  backdrop-filter: blur(14px);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.admin-select-all:hover,
.admin-select-chip:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(27, 49, 84, 0.1),
    0 14px 28px rgba(73, 108, 162, 0.14);
}

.admin-select-all input,
.admin-select-chip input {
  margin: 0;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--primary);
}

.admin-selection-summary {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.admin-batch-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-review-grid {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.admin-review-compact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.admin-review-compact-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  min-width: 0;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(245, 249, 255, 0.76) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(20, 16, 10, 0.05),
    0 18px 32px rgba(90, 126, 188, 0.08);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.admin-review-compact-card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px rgba(20, 16, 10, 0.05),
    0 22px 38px rgba(90, 126, 188, 0.12);
}

.admin-review-compact-card.is-locked {
  opacity: 0.68;
}

.admin-review-compact-preview {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(45deg, #dfe9f7 25%, transparent 25%),
    linear-gradient(-45deg, #dfe9f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dfe9f7 75%),
    linear-gradient(-45deg, transparent 75%, #dfe9f7 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
}

.admin-review-compact-body {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.admin-review-title-compact {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.admin-review-subtitle-compact {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-review-meta-compact {
  justify-content: space-between;
}

.admin-select-chip-compact {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  min-height: 36px;
  padding: 0 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(246, 249, 255, 0.92) 100%);
}

.admin-select-chip-compact span {
  line-height: 1;
}

.admin-select-chip input:checked + span,
.admin-select-all input:checked + span {
  color: var(--soft-button-text);
}

.admin-select-chip:has(input:checked),
.admin-select-all:has(input:checked) {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--primary) 12%, #fff 88%) 0%,
    color-mix(in srgb, var(--primary) 20%, #fff 80%) 100%
  );
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--primary) 26%, transparent),
    0 14px 28px var(--button-orange-shadow);
}

.admin-detail-trigger {
  min-height: 36px;
  font-size: 0.84rem;
}

.admin-detail-name {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
}

.admin-review-item {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 0 0 1px rgba(20, 16, 10, 0.05);
}

.admin-review-item.is-locked {
  opacity: 0.68;
}

.admin-review-media {
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(45deg, #dfe9f7 25%, transparent 25%),
    linear-gradient(-45deg, #dfe9f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dfe9f7 75%),
    linear-gradient(-45deg, transparent 75%, #dfe9f7 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
}

.admin-review-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.admin-review-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.admin-review-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-review-date {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.admin-review-title {
  margin: 0;
  font-size: 1.28rem;
}

.admin-review-subtitle {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.admin-review-links,
.admin-review-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-review-note-block {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 0 0 1px rgba(20, 16, 10, 0.05);
}

.admin-review-note-text,
.admin-review-last-log {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  word-break: break-word;
}

.admin-review-links a {
  text-decoration: none;
}

.admin-review-note textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
}

.admin-status-chip.status-pending {
  color: #7a4a00;
  background: rgba(255, 231, 184, 0.9);
}

.admin-status-chip.status-approved {
  color: #0a6640;
  background: rgba(200, 245, 220, 0.9);
}

.admin-status-chip.status-rejected,
.admin-status-chip.status-hidden {
  color: #8b3145;
  background: rgba(255, 219, 226, 0.92);
}

.danger-button {
  color: #93284a;
  box-shadow: inset 0 0 0 1px rgba(147, 40, 74, 0.16);
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.admin-pagination-info {
  color: var(--muted);
  font-weight: 700;
}

.admin-log-card {
  margin-top: 18px;
}

.admin-log-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.admin-log-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(245, 249, 255, 0.74) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(20, 16, 10, 0.05),
    0 14px 28px rgba(90, 126, 188, 0.08);
}

.admin-log-main {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-log-action {
  color: var(--accent);
}

.admin-log-title {
  font-weight: 700;
}

.admin-log-note,
.admin-log-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-confirm-dialog {
  width: min(92vw, 460px);
}

.admin-detail-dialog {
  width: min(94vw, 920px);
}

.admin-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-detail-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 20px;
}

.admin-detail-preview {
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(45deg, #dfe9f7 25%, transparent 25%),
    linear-gradient(-45deg, #dfe9f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dfe9f7 75%),
    linear-gradient(-45deg, transparent 75%, #dfe9f7 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
}

.admin-detail-preview img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.admin-detail-content {
  display: grid;
  gap: 12px;
}

.admin-detail-meta {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.5;
}

.admin-review-actions-sticky {
  margin-top: 4px;
}

.chip-row-muted .mini-chip {
  background: rgba(255, 255, 255, 0.82);
}

.gallery-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#sortFilterBar {
  flex: 1 1 auto;
}

.gallery-sort-chip {
  position: relative;
  flex: 0 0 auto;
}

.gallery-sort-chip::after {
  content: "⌄";
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-52%);
  color: var(--muted);
  font-size: 0.82rem;
  pointer-events: none;
}

.gallery-sort-chip select {
  width: auto;
  min-width: 92px;
  padding: 10px 34px 10px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--soft-button-bg);
  color: var(--button-cream-ink);
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 8px 18px var(--soft-button-shadow);
  appearance: none;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.gallery-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 28px rgba(73, 108, 162, 0.08);
  overflow: hidden;
}

.gallery-card.selected {
  border-color: rgba(137, 183, 243, 0.8);
}

.gallery-card-preview {
  display: block;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #edf4ff;
  aspect-ratio: 1 / 1;
  -webkit-touch-callout: none;
  user-select: none;
}

.gallery-card-preview img {
  width: 100%;
  max-width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
  pointer-events: none;
}

.gallery-card-body {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.gallery-card-date,
.gallery-card-meta {
  font-size: 0.76rem;
  line-height: 1.2;
}

.gallery-card-meta {
  margin-top: -2px;
}

.my-work-status {
  font-weight: 700;
}

.my-work-status.status-approved {
  color: #2f9e5b;
}

.my-work-status.status-rejected {
  color: #d84f5f;
}

.my-work-status.status-pending {
  color: #d2a22d;
}

.my-work-status.status-hidden {
  color: var(--muted);
}

.my-work-note {
  margin: -1px 0 0;
  color: #d84f5f;
  font-size: 0.75rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-card-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card-footer {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  color: var(--soft-button-text);
  font-size: 1rem;
  line-height: 1;
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    0 12px 22px var(--soft-button-shadow);
}

.icon-action:hover {
  transform: translateY(-1px);
  filter: saturate(1.03);
}

.icon-action:active {
  transform: translateY(1px);
}

.download-action {
  width: 42px;
  min-width: 42px;
  padding: 0;
  background: var(--soft-button-bg-strong);
  color: var(--soft-button-text);
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 10px 20px var(--soft-button-shadow);
}

.download-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.download-action:hover .download-icon {
  transform: translateY(1px);
}

.favorite-action {
  width: 42px;
  min-width: 42px;
  padding: 0;
  background: var(--soft-button-bg-strong);
  color: var(--soft-button-text);
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 10px 20px var(--soft-button-shadow);
}

.favorite-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.favorite-action.active {
  color: var(--favorite-active-text);
  background: var(--favorite-active-bg);
  transform: translateY(-1px);
  text-shadow: none;
}

.favorite-action.active .favorite-icon {
  fill: currentColor;
  stroke: currentColor;
  transform: scale(1.04);
}

.gallery-favorite-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--count-pill-bg);
  box-shadow: inset 0 0 0 1px rgba(16, 35, 63, 0.05), 0 10px 24px var(--count-pill-shadow);
  font-weight: 700;
  font-size: 1rem;
  color: var(--count-pill-text);
  text-align: center;
}

.support-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.support-panel {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px rgba(39, 72, 122, 0.08);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 24px;
  border-radius: var(--radius-xl);
  background: rgba(247, 251, 255, 0.6);
  text-align: center;
}

.inline-notice {
  font-size: 0.9rem;
  font-weight: 700;
}

.inline-notice.success {
  color: #2f6fc9;
}

.inline-notice.error {
  color: #d1536c;
}

@media (max-width: 960px) {
  .editor-layout,
  .support-grid,
  .two-up,
  .config-row {
    grid-template-columns: 1fr;
  }

  .preview-stage {
    min-height: 0;
  }

  .preview-heading {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 4px;
  }

  .preview-tip {
    text-align: left;
    white-space: normal;
  }

  .inline-slider-field {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .inline-slider-field span {
    justify-self: start;
    min-width: 0;
    text-align: left;
  }

  .welcome-panel {
    width: min(92vw, 680px);
  }

  .switch-connect-shell {
    grid-template-columns: 1fr;
  }

  .mii-control-grid {
    grid-template-columns: 1fr;
  }

  .mii-tool-grid {
    grid-template-columns: 1fr;
  }

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

  .mii-apply-floating {
    grid-template-columns: 1fr;
    width: min(620px, calc(100vw - 28px));
  }

  .switch-page-grid {
    grid-template-columns: 1fr;
  }

  .switch-submit-floating {
    grid-template-columns: 1fr;
    width: min(620px, calc(100vw - 28px));
  }
}

@media (max-width: 720px) {
  :root {
    --content-width: min(100vw - 30px, 1000px);
  }

  .confirm-modal,
  .mii-share-detail-modal,
  .support-qr-modal {
    padding: 14px;
    justify-items: center;
    align-items: center;
  }

  .support-qr-modal-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .shell-header {
    padding-top: 12px;
  }

  .nav-pill {
    padding: 10px;
    border-radius: 24px;
  }

  .page-tabs,
  .action-bar {
    width: 100%;
  }

  .page-tabs > * {
    flex: 1 1 calc(50% - 6px);
  }

  .action-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .action-bar > * {
    width: 100%;
    min-width: 0;
    padding-inline: 10px;
    font-size: 0.98rem;
    line-height: 1.25;
  }

  .freeform-erase-field {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 7px;
    padding: 8px;
    margin-top: 8px;
    border-radius: 20px;
  }

  .freeform-mobile-slot {
    display: block;
    margin-top: 8px;
  }

  .freeform-mobile-slot .freeform-erase-field {
    margin-top: 0;
  }

  .freeform-erase-field .secondary-button {
    width: 100%;
    min-height: 38px;
    padding: 7px 6px;
    font-size: 0.82rem;
    line-height: 1.12;
  }

  .freeform-erase-field span {
    grid-column: 1 / -1;
    order: -1;
    min-height: 2.5em;
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .freeform-erase-field .freeform-apply-button {
    grid-column: 1 / -1;
    order: 9;
    min-height: 42px;
    font-size: 0.95rem;
  }

  .confirm-modal-dialog {
    width: min(92vw, 360px);
    padding: 20px 16px;
  }

  .tomodachi-instruction-dialog {
    width: calc(100vw - 20px);
    max-height: 86vh;
    padding: 14px 10px;
    border-radius: 22px;
  }

  .tomodachi-instruction-dialog h2 {
    font-size: 1.15rem;
    padding-right: 44px;
  }

  .tomodachi-instruction-content {
    gap: 8px;
    font-size: 0.8rem;
  }

  .tomodachi-instruction-heading strong {
    font-size: 1rem;
  }

  .tomodachi-instruction-heading span {
    font-size: 0.7rem;
  }

  .tomodachi-instruction-section {
    gap: 6px;
    width: 100%;
    padding: 9px 9px 9px 10px;
    border-left-width: 4px;
    border-radius: 0 12px 12px 0;
  }

  .tomodachi-instruction-section.is-subsection {
    width: 100%;
    padding: 2px 0 0 6px;
  }

  .tomodachi-instruction-section h3 {
    font-size: 0.98rem;
  }

  .tomodachi-instruction-section td {
    padding: 3px 0;
  }

  .tomodachi-instruction-section td:first-child {
    width: 78px;
    padding-right: 10px;
    font-size: 0.72rem;
  }

  .tomodachi-instruction-section td:last-child,
  .tomodachi-color-value em {
    font-size: 0.8rem;
  }

  .tomodachi-color-value i {
    width: 17px;
    height: 17px;
    border-radius: 5px;
  }

  .tomodachi-personality-row {
    grid-template-columns: 42px 28px minmax(0, 1fr) 28px;
    gap: 5px;
  }

  .tomodachi-personality-row > div {
    gap: 2px;
  }

  .tomodachi-personality-row i {
    width: 14px;
    height: 14px;
    border-radius: 5px;
  }

  .tomodachi-personality-row b,
  .tomodachi-personality-row span {
    font-size: 0.68rem;
  }

  .confirm-modal-actions {
    flex-direction: column-reverse;
  }

  .generator-card,
  .preview-card,
  .support-card,
  .admin-card,
  .mii-connect-card,
  .mii-tool-card,
  .mii-sav-card,
  .switch-connect-card,
  .switch-source-card,
  .switch-target-card,
  .switch-settings-card {
    padding: 12px;
  }

  .admin-heading,
  .admin-review-item {
    grid-template-columns: 1fr;
  }

  .admin-heading {
    display: grid;
  }

  .admin-search-row,
  .admin-batch-bar,
  .admin-pagination {
    display: grid;
  }

  .admin-review-compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-detail-layout {
    grid-template-columns: 1fr;
  }

  .admin-batch-actions {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    display: grid;
  }

  .admin-select-all {
    justify-content: center;
    width: fit-content;
    min-height: 44px;
    padding: 0 14px;
  }

  .upload-dropzone {
    min-height: 104px;
    border-radius: 22px;
  }

  body.freeform-editor-active .editor-layout {
    gap: 10px;
  }

  body.freeform-editor-active .generator-card,
  body.freeform-editor-active .preview-card {
    padding: 10px;
  }

  body.freeform-editor-active .upload-dropzone,
  body.freeform-editor-active .field:first-child {
    display: none;
  }

  body.freeform-editor-active .form-stack,
  body.freeform-editor-active .compact-stack,
  body.freeform-editor-active .config-card {
    gap: 8px;
    margin-top: 8px;
  }

  body.freeform-editor-active .config-card {
    padding: 10px;
  }

  body.freeform-editor-active .config-row {
    gap: 6px;
  }

  body.freeform-editor-active .config-row h2 {
    font-size: 0.95rem;
  }

  body.freeform-editor-active .config-row p {
    display: none;
  }

  body.freeform-editor-active .slider-field input[type="range"] {
    height: 24px;
  }

  body.freeform-editor-active .action-bar {
    gap: 8px;
  }

  body.freeform-editor-active .action-bar > * {
    min-height: 40px;
    padding-block: 8px;
    font-size: 0.9rem;
  }

  body.freeform-editor-active .preview-card {
    position: sticky;
    top: 8px;
    z-index: 6;
  }

  body.freeform-editor-active .preview-heading {
    margin-bottom: 6px;
  }

  body.freeform-editor-active .preview-heading .eyebrow,
  body.freeform-editor-active .preview-tip {
    display: none;
  }

  body.freeform-editor-active .preview-heading h2 {
    font-size: 0.98rem;
  }

  body.freeform-editor-active .preview-meta {
    padding: 8px 10px;
    font-size: 0.86rem;
  }

  body.freeform-editor-active .preview-card {
    overflow: visible;
  }

  .gallery-toolbar-row {
    gap: 8px;
  }

  .gallery-sort-chip select {
    min-width: 84px;
    padding-inline: 12px 30px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .welcome-shell {
    padding: 18px;
  }

  .welcome-panel {
    width: min(100vw - 44px, 680px);
    padding: 26px 22px;
    border-radius: 30px;
  }

  .welcome-title {
    margin-top: 12px;
  }

  .welcome-copy {
    margin-top: 16px;
    font-size: 1rem;
  }

  .welcome-start-button {
    width: 100%;
    min-width: 0;
    margin-top: 30px;
    padding-block: 16px;
    font-size: 1.45rem;
  }

  .welcome-float {
    padding: 6px;
    border-radius: 18px;
  }

  .switch-action-row,
  .mii-action-row,
  .switch-scan-actions,
  .switch-source-meta {
    grid-template-columns: 1fr;
  }

  .switch-connect-input-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .switch-check-button {
    width: 100%;
    min-width: 0;
  }

  .switch-action-row > * {
    min-height: 44px;
  }

  .mii-share-search,
  .mii-share-detail-body {
    grid-template-columns: 1fr;
  }

  .mii-tool-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  .mii-main-column,
  .mii-top-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  .mii-main-column > *,
  .mii-top-row > *,
  .mii-attributes-card,
  .mii-share-card,
  .mii-pending-card {
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }

  .mii-top-row .mii-mini-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .mii-top-row .mii-mini-actions > * {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding-inline: 8px;
    border-radius: 16px;
    font-size: 0.9rem;
    box-sizing: border-box;
    justify-content: center;
  }

  .mii-share-submit-button {
    grid-column: auto;
  }

  .mii-publish-upload-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .mii-publish-drop {
    min-height: 82px;
    padding: 6px;
    border-radius: 14px;
  }

  .mii-publish-drop img {
    max-height: 64px;
  }

  .mii-publish-drop span {
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .mii-publish-source-chip {
    min-height: 30px;
    padding: 5px 4px;
    border-radius: 13px;
    font-size: 0.68rem;
    line-height: 1.12;
  }

  .mii-publish-input-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .mii-publish-source-chip[data-open-file-input$="CameraInput"] {
    display: inline-flex;
  }

  .mii-gallery-compact-detail {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .mii-gallery-detail-images {
    grid-template-columns: 1fr;
    gap: 2px !important;
    padding: 2px;
    background: transparent;
    box-shadow: none;
  }

  .mii-gallery-detail-figure {
    gap: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .mii-gallery-detail-figure figcaption {
    margin: 0;
    font-size: 0.68rem;
    line-height: 1;
  }

  .mii-gallery-detail-figure img {
    border-radius: 12px;
  }

  .mii-gallery-detail-images .mii-gallery-detail-figure + .mii-gallery-detail-figure {
    margin-top: 0 !important;
  }

  .mii-share-save-preview {
    min-height: 156px;
  }

  .mii-gallery-compact-detail .mii-share-detail-row {
    grid-template-columns: 48px minmax(0, 1fr);
    font-size: 0.82rem;
  }

  .mii-share-card {
    grid-column: 1 / -1;
  }

  .mii-gallery-card .gallery-card-footer {
    grid-template-columns: 36px minmax(28px, 36px) minmax(66px, 1fr);
    gap: 5px;
  }

  .mii-gallery-card .gallery-favorite-count {
    min-width: 28px;
    padding: 0 2px;
    font-size: 0.72rem;
  }

  .mii-gallery-card .mii-want-button {
    min-width: 0;
    padding: 0 4px;
    font-size: 0.7rem;
  }

  .mii-attribute-panel {
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .mii-attr-card {
    width: 100%;
    justify-self: stretch;
    gap: 6px;
    padding: 10px;
    border-radius: 18px;
  }

  .mii-attr-card h3 {
    font-size: 0.74rem;
  }

  .mii-attr-grid {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    gap: 6px;
    width: 100%;
  }

  .mii-attr-field {
    gap: 2px;
  }

  .mii-attr-field span {
    font-size: 0.58rem;
  }

  .mii-attr-field input,
  .mii-attr-field select {
    min-height: 30px;
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 16px;
  }

  .mii-publish-dialog input,
  .mii-publish-dialog textarea,
  .mii-publish-dialog select {
    font-size: 16px;
  }

  .mii-share-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mii-share-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mii-share-item {
    gap: 7px;
    padding: 8px;
  }

  .mii-share-main {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 7px;
  }

  .mii-share-item img {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .mii-share-detail-dialog {
    width: auto;
    max-width: 460px;
    margin-inline: 0;
    justify-self: stretch;
    padding: 14px 12px;
    align-self: center;
  }

  .mii-publish-dialog {
    width: auto;
    max-width: 620px;
    margin-inline: 0;
    justify-self: stretch;
    max-height: min(92vh, 760px);
    padding: 14px 12px;
    gap: 8px;
    align-self: center;
  }

  .mii-publish-dialog .switch-scan-header {
    gap: 8px;
  }

  .mii-publish-dialog .switch-scan-header h2 {
    font-size: 1.1rem;
  }

  .mii-publish-dialog .switch-scan-header p {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .mii-publish-dialog .field {
    gap: 5px;
  }

  .mii-publish-dialog input,
  .mii-publish-dialog textarea {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 14px;
    font-size: 16px;
  }

  .mii-publish-dialog textarea {
    min-height: 64px;
  }

  .mii-publish-dialog .confirm-modal-actions {
    position: sticky;
    bottom: -14px;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 8px;
    padding-bottom: 4px;
    background: linear-gradient(180deg, rgba(236, 245, 255, 0), rgba(236, 245, 255, 0.98) 34%);
  }

  .mii-publish-dialog .confirm-modal-actions > * {
    width: 100%;
    min-height: 40px;
    padding-inline: 8px;
    font-size: 0.9rem;
  }

  .mii-share-detail-main-image {
    min-height: 220px;
  }

  .mii-share-detail-content {
    gap: 8px;
  }

  .mii-share-detail-body {
    gap: 8px;
  }

  .mii-share-detail-gallery,
  .mii-share-detail-info {
    gap: 7px;
  }

  .mii-share-detail-main-image {
    min-height: 170px;
    border-radius: 18px;
  }

  .mii-share-detail-main-image img {
    max-height: 220px;
  }

  .mii-share-detail-thumbs {
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 5px;
  }

  .mii-share-detail-thumb {
    border-radius: 12px;
    padding: 3px;
  }

  .mii-share-detail-row {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .mii-slot-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-items: stretch;
    max-height: 190px;
    padding-right: 0;
  }

  .mii-slot-chip {
    min-height: 38px;
    padding: 5px 5px;
    border-radius: 14px;
  }

  .mii-slot-chip strong {
    font-size: 0.76rem;
  }

  .mii-empty-card.wide {
    min-height: 86px;
    padding: 14px 10px;
    font-size: clamp(0.66rem, 2.8vw, 0.86rem);
  }

  .switch-target-item {
    min-height: 38px;
    padding: 6px 8px;
  }

  .switch-target-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .switch-scan-video-shell,
  .switch-scan-video {
    min-height: 260px;
  }

  .switch-source-meta > div {
    padding: 10px 12px;
  }
}

@media (max-width: 520px) {
  :root {
    --content-width: min(100vw - 36px, 1000px);
  }

  h1 {
    font-size: 1.8rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .gallery-toolbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 8px;
    row-gap: 8px;
  }

  #sortFilterBar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
  }

  #sortFilterBar .mini-chip {
    padding: 8px 11px;
    font-size: 0.84rem;
  }

  .gallery-sort-chip {
    justify-self: end;
    align-self: end;
    margin-top: 8px;
  }

  .gallery-sort-chip select {
    min-width: 78px;
    padding: 9px 28px 9px 12px;
  }

  .admin-review-compact-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .admin-review-compact-card {
    padding: 8px;
    border-radius: 16px;
  }

  .admin-count-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .admin-count-bar .mini-chip {
    width: 100%;
    justify-content: center;
  }

  .admin-search-row > .secondary-button {
    width: 100%;
  }

  .admin-batch-bar {
    gap: 10px;
    padding: 10px;
  }

  .admin-select-all {
    justify-content: space-between;
    width: 100%;
    padding-inline: 12px;
    min-height: 42px;
  }

  .admin-selection-summary {
    font-size: 0.9rem;
  }

  .admin-batch-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .admin-review-title-compact {
    font-size: 0.86rem;
  }

  .admin-review-subtitle-compact {
    font-size: 0.72rem;
  }

  .admin-select-chip-compact {
    min-height: 36px;
    padding: 0 12px;
  }

  .admin-detail-trigger {
    min-height: 34px;
    font-size: 0.84rem;
  }

  .gallery-card {
    gap: 8px;
    padding: 8px;
    border-radius: 18px;
  }

  .gallery-card-footer {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 6px;
  }

  .mii-tool-grid,
  .mii-main-column,
  .mii-top-row {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  .mii-main-column > *,
  .mii-top-row > *,
  .mii-attributes-card,
  .mii-share-card,
  .mii-pending-card,
  .mii-tool-card {
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }

  .mii-pending-box,
  .mii-empty-card.wide {
    min-width: 0;
  }

  .mii-gallery-card .gallery-card-footer {
    grid-template-columns: 34px minmax(24px, 32px) minmax(58px, 1fr);
    gap: 4px;
  }

  .mii-gallery-card .gallery-favorite-count {
    height: 38px;
    min-width: 24px;
    padding: 0 1px;
    font-size: 0.68rem;
  }

  .mii-gallery-card .mii-want-button {
    min-height: 38px;
    min-width: 0;
    padding: 0 3px;
    font-size: 0.66rem;
  }

  .download-action {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .favorite-action {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .gallery-favorite-count {
    height: 40px;
    padding: 0 10px;
    font-size: 0.96rem;
  }

  .download-icon {
    width: 18px;
    height: 18px;
  }

  .favorite-icon {
    width: 18px;
    height: 18px;
  }

  .gallery-sort-chip select,
  .mini-chip {
    padding: 9px 13px;
    font-size: 0.88rem;
  }

  .welcome-panel {
    width: min(100vw - 28px, 680px);
    padding: 22px 18px;
    border-radius: 28px;
  }

  .welcome-title {
    font-size: 2.1rem;
  }

  .back-to-top {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 16px));
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  .floating-tools {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 16px));
    gap: 8px;
  }

  .floating-tool-button {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  .theme-panel {
    right: max(72px, calc(env(safe-area-inset-right) + 72px));
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 16px));
  }

  .theme-panel-card {
    width: min(250px, calc(100vw - 92px));
    padding: 14px;
    border-radius: 18px;
  }

  .switch-connect-card,
  .switch-source-card,
  .switch-target-card,
  .switch-settings-card {
    padding: 10px;
    border-radius: 22px;
  }

  .switch-page-layout,
  .switch-page-grid {
    gap: 12px;
  }

  .switch-page-grid {
    grid-template-columns: 1fr;
  }

  .switch-connect-status-card,
  .switch-connect-input-card,
  .switch-submit-panel,
  .switch-target-empty {
    padding: 14px;
    border-radius: 20px;
  }

  .switch-submit-floating {
    bottom: max(12px, env(safe-area-inset-bottom));
    gap: 10px;
  }

  .switch-source-preview-shell {
    max-width: none;
    border-radius: 20px;
  }

  .switch-target-grid {
    gap: 10px;
  }

  .switch-target-item {
    padding: 8px;
    border-radius: 18px;
  }

  .switch-target-head {
    gap: 6px;
  }

  .switch-target-head span,
  .switch-target-body code {
    font-size: 0.72rem;
  }

  .switch-scan-dialog {
    padding: 18px 14px;
  }

  .switch-connect-shell {
    gap: 8px;
  }

  .switch-action-row {
    gap: 8px;
  }

  .switch-action-row > * {
    min-height: 42px;
    font-size: 0.94rem;
  }

  .switch-connect-status-card strong {
    font-size: 0.98rem;
  }

  .switch-inline-copy,
  .switch-source-placeholder span,
  .switch-target-empty span,
  .switch-scan-empty span,
  .switch-scan-status {
    font-size: 0.83rem;
  }
}
