:root {
    --bg: #f2f5f9;
    --card: #ffffff;
    --text: #22303d;
    --accent: #4f8fe8;
    --border: #d1dde9;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "Hiragino Kaku Gothic Pro", Meiryo, sans-serif;
    background: linear-gradient(180deg, #eef5fb 0%, #f8fafc 100%);
    color: var(--text);
}

.app-container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 28px 16px;
}

header {
    text-align: center;
    margin-bottom: 28px;
}

h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 4vw, 3rem);
}

p {
    margin: 0;
    color: #546b82;
}

main {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 24px;
}

.landing-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

.landing-hero {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.landing-copy {
    flex: 1 1 360px;
    min-width: 320px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.landing-preview-cards {
    display: grid;
    grid-template-columns: repeat( auto-fit, minmax(220px, 1fr) );
    gap: 16px;
    width: 100%;
}

.preview-card {
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 12px 35px rgba(98, 127, 179, 0.08);
}

.preview-frame {
    position: relative;
    overflow: hidden;
    min-height: 220px;
    border-radius: 18px;
    background: #f6f9ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-frame-simple {
    min-height: 180px;
}

.preview-layer {
    max-width: 80%;
    max-height: 80%;
}

.preview-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(79, 143, 232, 0.12);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.feature-item {
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.feature-item h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.feature-item p {
    color: #55667d;
}

.viewer {
    padding: 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 560px;
}

.character-card {
    position: relative;
    width: min(420px, 100%);
    aspect-ratio: 1 / 1;
    background: #f8fbff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 18px 45px rgba(63, 94, 174, 0.08);
}

.character-card .layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    z-index: 1;
}

#background-layer {
    z-index: 0;
}

#body-layer {
    z-index: 2;
}

#eyes-layer {
    z-index: 3;
}

#nose-layer {
    z-index: 4;
}

#mouth-layer {
    z-index: 5;
}

#shoes-layer {
    z-index: 6;
}

#bottoms-layer {
    z-index: 7;
}

#tops-layer {
    z-index: 8;
}

#onepiece-layer {
    z-index: 9;
}

#accessory1-layer {
    z-index: 10;
}

#accessory2-layer {
    z-index: 11;
}

#hair-layer {
    z-index: 12;
}

.character-img {
    width: 100%;
    max-height: 560px;
    object-fit: contain;
    border-radius: 18px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.group-tab {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.group-tab:hover,
.group-tab.active {
    border-color: var(--accent);
    background: rgba(79, 143, 232, 0.08);
    color: #1b355f;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.filter-group select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
}

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

.item-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease;
}

.item-card.locked {
    opacity: 0.72;
    cursor: default;
}

.item-card .item-detail {
    margin-left: auto;
    color: #5c6c88;
    font-size: 0.9rem;
}

.purchase-button {
    margin-left: 12px;
    padding: 8px 12px;
    border: none;
    border-radius: 12px;
    background: #f0ad4e;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.purchase-button:hover {
    background: #e69539;
}

.item-card:hover,
.item-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.item-card img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.item-card span {
    font-size: 0.95rem;
    color: #2f4151;
}

@media (max-width: 960px) {
    main {
        grid-template-columns: 1fr;
    }
}

.top-nav {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.text-link {
    color: var(--accent);
    text-decoration: none;
}

.divider {
    color: #8a9cb7;
}

.primary-button {
    width: 100%;
    max-width: 320px;
    padding: 14px 18px;
    border: none;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.primary-button:hover {
    background: #3e78d6;
    transform: translateY(-1px);
}

.action-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.save-message {
    color: #2f5d32;
    font-size: 0.95rem;
    min-height: 1.3em;
}

.login-prompt {
    margin: 0;
    color: #546b82;
    font-size: 0.95rem;
}

.saved-section {
    margin-top: 24px;
    padding: 18px;
    background: #f8fbff;
    border: 1px solid var(--border);
    border-radius: 18px;
}

.saved-section h2 {
    margin: 0 0 14px;
    font-size: 1.1rem;
}

.saved-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.saved-item {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.saved-item img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 14px;
}

.saved-meta {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #6b7a8e;
}

.auth-page {
    max-width: 920px;
    margin: 60px auto;
    padding: 28px 24px;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

.profile-main,
.profile-sidebar {
    display: grid;
    gap: 24px;
}

.profile-section,
.admin-panel {
    padding: 22px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.profile-section h2,
.admin-panel h2,
.admin-panel h3 {
    margin-top: 0;
}

.profile-section p,
.admin-panel p {
    color: #55667d;
}

.profile-sidebar {
    display: grid;
    gap: 18px;
}

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

.profile-section-head h2 {
    margin-bottom: 8px;
}

.profile-section-head p {
    margin: 0;
    color: #55667d;
}

.points-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(79, 143, 232, 0.12);
    color: var(--accent);
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.saved-select {
    display: grid;
    gap: 12px;
}

.active-avatar-preview {
    display: grid;
    gap: 12px;
    margin: 18px 0 16px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, #f9fbff 0%, #eef5ff 100%);
}

.active-avatar-preview--empty {
    background: linear-gradient(180deg, #fcfdff 0%, #f3f7fd 100%);
}

.active-avatar-frame {
    position: relative;
    aspect-ratio: 1 / 1;
    width: min(260px, 100%);
    margin: 0 auto;
    border-radius: 18px;
    border: 1px solid rgba(209, 221, 233, 0.95);
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.65), transparent 42%),
        linear-gradient(180deg, #f8fbff 0%, #eef4fc 100%);
}

.active-avatar-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.active-avatar-layer--background { z-index: 0; }
.active-avatar-layer--body { z-index: 2; }
.active-avatar-layer--eyes { z-index: 3; }
.active-avatar-layer--nose { z-index: 4; }
.active-avatar-layer--mouth { z-index: 5; }
.active-avatar-layer--shoes { z-index: 6; }
.active-avatar-layer--bottoms { z-index: 7; }
.active-avatar-layer--tops { z-index: 8; }
.active-avatar-layer--onepiece { z-index: 9; }
.active-avatar-layer--accessory1 { z-index: 10; }
.active-avatar-layer--accessory2 { z-index: 11; }
.active-avatar-layer--hair { z-index: 12; }

.active-avatar-copy {
    display: grid;
    gap: 4px;
    text-align: center;
}

.active-avatar-copy strong {
    font-size: 1rem;
}

.active-avatar-copy span {
    color: #5c6c82;
    line-height: 1.6;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8fbff;
}

.admin-form {
    padding: 0;
    border: none;
    background: transparent;
    gap: 14px;
}

.admin-form label {
    gap: 6px;
}

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

.auth-form {
    display: grid;
    gap: 18px;
    padding: 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.auth-form label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

.auth-form input,
.auth-form select,
.auth-form textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}

.auth-form textarea {
    resize: vertical;
    min-height: 120px;
}

.points-form {
    padding: 24px;
}

.points-form select {
    width: 100%;
}

.points-form .primary-button {
    max-width: 320px;
}

.error-message {
    color: #b93a3a;
    background: #ffecec;
    border: 1px solid #f2c3c3;
    padding: 12px 14px;
    border-radius: 12px;
}

.success-message {
    color: #23663a;
    background: #eaf7ef;
    border: 1px solid #bfe2ca;
    padding: 12px 14px;
    border-radius: 12px;
}

.form-note {
    margin: 0;
    font-size: 0.95rem;
    color: #5f7186;
}

.form-note a {
    color: var(--accent);
}

.secondary-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 320px;
    padding: 12px 18px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: background .2s ease, border-color .2s ease;
}

.secondary-button:hover {
    background: #f4f8ff;
    border-color: var(--accent);
}

.admin-page .secondary-button,
.admin-upload-page .secondary-button,
.admin-actions-inline .secondary-button {
    width: auto;
    max-width: none;
}

.home-links-page {
    max-width: 520px;
}

.home-links-card {
    padding: 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 18px 45px rgba(63, 94, 174, 0.08);
}

.home-links-grid {
    display: grid;
    gap: 12px;
    justify-items: stretch;
}

.home-links-grid .primary-button,
.home-links-grid .secondary-button {
    display: flex;
    width: 100%;
    max-width: none;
    justify-content: center;
}

.home-page {
    max-width: 1240px;
}

.top-nav {
    flex-wrap: wrap;
    align-items: center;
}

.hero-actions,
.workspace-links,
.locked-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.hero-actions .primary-button,
.hero-actions .secondary-button,
.workspace-links .primary-button,
.workspace-links .secondary-button,
.locked-actions .primary-button,
.locked-actions .secondary-button {
    width: auto;
    max-width: none;
    min-width: 160px;
}

.landing-hero {
    align-items: stretch;
}

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

.landing-copy h2,
.section-head h2,
.preview-card h3,
.feature-item h3,
.saved-section h2 {
    line-height: 1.25;
}

.landing-copy h2 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.landing-copy p {
    max-width: 60ch;
}

.preview-card h3 {
    margin: 16px 0 8px;
}

.preview-card p,
.feature-item p,
.section-head p,
.locked-panel p {
    line-height: 1.7;
}

.preview-frame .preview-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.workspace-section {
    padding: 24px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 16px 42px rgba(98, 127, 179, 0.08);
    backdrop-filter: blur(8px);
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.section-head > div:first-child {
    display: grid;
    gap: 8px;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
    gap: 24px;
    align-items: start;
}

.viewer {
    min-height: 640px;
}

.character-card {
    width: min(480px, 100%);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.65), transparent 40%),
        linear-gradient(180deg, #f8fbff 0%, #eef4fc 100%);
    border: 1px solid rgba(209, 221, 233, 0.9);
}

.controls {
    gap: 18px;
}

.groups-panel {
    gap: 12px;
}

.group-tab {
    font-weight: 700;
}

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

.no-items {
    padding: 16px;
    margin: 0;
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: #f8fbff;
    color: #5f7186;
}

.locked-panel {
    padding: 22px;
    border: 1px dashed var(--border);
    border-radius: 20px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
}

.locked-panel h3 {
    margin: 0 0 10px;
}

.lock-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lock-tag {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #49617a;
    font-size: 0.88rem;
}

.saved-thumb {
    display: grid;
    gap: 6px;
}

.saved-desc {
    color: #5f7186;
    font-size: 0.95rem;
}

.saved-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.saved-actions button {
    padding: 8px 12px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.saved-actions .saved-overwrite {
    background: #64748b;
}

.saved-actions .saved-saveas {
    background: #7d6cf1;
}

.saved-actions button:hover {
    filter: brightness(0.96);
}

.saved-section .saved-item {
    align-items: start;
}

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

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .workspace-links {
        justify-content: flex-start;
    }

    .viewer {
        min-height: 520px;
    }
}

@media (max-width: 720px) {
    .hero-actions .primary-button,
    .hero-actions .secondary-button,
    .workspace-links .primary-button,
    .workspace-links .secondary-button,
    .locked-actions .primary-button,
    .locked-actions .secondary-button {
        width: 100%;
        min-width: 0;
    }

    .groups-panel,
    .item-list {
        grid-template-columns: 1fr;
    }

    .saved-item {
        grid-template-columns: 1fr;
    }
}

.dressup-page main.workspace-section {
    display: block;
}

.dressup-page .workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.92fr);
    gap: 28px;
    align-items: start;
}

.dressup-page .viewer {
    position: sticky;
    top: 20px;
    align-self: start;
    min-height: clamp(760px, 84vh, 1020px);
    padding: 28px;
}

.dressup-page .character-card {
    width: min(760px, 100%);
}

.dressup-page .controls {
    display: grid;
    gap: 18px;
}

.dressup-page .controls-intro {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 22px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 12px 35px rgba(63, 94, 174, 0.08);
}

.dressup-page .controls-intro h2 {
    margin: 4px 0 8px;
    font-size: clamp(1.5rem, 2vw, 1.95rem);
}

.dressup-page .controls-note {
    margin: 0;
    color: #5c6c88;
    line-height: 1.65;
}

.dressup-page .controls-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(79, 143, 232, 0.12);
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
}

.dressup-page .eyebrow--small {
    margin-bottom: 6px;
    font-size: 0.78rem;
}

.dressup-page .search-field {
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 12px 35px rgba(63, 94, 174, 0.05);
}

.dressup-page .search-field span {
    font-weight: 700;
    color: #2f4151;
}

.dressup-page .search-field input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f9fbff;
    color: var(--text);
    font-size: 1rem;
}

.dressup-page .search-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 143, 232, 0.12);
}

.dressup-page .groups-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.dressup-page .group-tab {
    min-height: 48px;
    padding: 13px 14px;
    border-radius: 16px;
    font-weight: 700;
}

.dressup-page .stack-note {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px dashed var(--border);
    background: #f8fbff;
    color: #5c6c88;
    line-height: 1.7;
}

.dressup-page .item-browser {
    display: grid;
    gap: 16px;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 16px 42px rgba(63, 94, 174, 0.08);
}

.dressup-page .browser-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dressup-page .browser-summary {
    display: grid;
    gap: 4px;
}

.dressup-page .browser-summary strong {
    font-size: 1.05rem;
}

.dressup-page .browser-summary span {
    color: #5c6c88;
    font-size: 0.92rem;
}

.dressup-page .item-scroll {
    max-height: clamp(360px, 56vh, 720px);
    overflow: auto;
    padding-right: 4px;
}

.dressup-page .item-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.dressup-page .item-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    cursor: pointer;
    align-content: start;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.dressup-page .item-card:hover,
.dressup-page .item-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 12px 22px rgba(63, 94, 174, 0.12);
}

.dressup-page .item-card.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(79, 143, 232, 0.14), 0 12px 22px rgba(63, 94, 174, 0.12);
}

.dressup-page .item-card.locked {
    cursor: default;
    opacity: 0.78;
}

.dressup-page .item-thumb {
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    background: linear-gradient(180deg, #eef5ff 0%, #ffffff 100%);
    border: 1px solid rgba(209, 221, 233, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.dressup-page .item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dressup-page .item-copy {
    display: grid;
    gap: 6px;
}

.dressup-page .item-copy strong {
    font-size: 0.96rem;
    line-height: 1.35;
    color: var(--text);
}

.dressup-page .item-meta {
    margin: 0;
    color: #5c6c88;
    font-size: 0.88rem;
}

.dressup-page .item-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dressup-page .item-badge,
.dressup-page .item-select-hint {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.dressup-page .item-badge {
    background: rgba(79, 143, 232, 0.12);
    color: var(--accent);
}

.dressup-page .item-select-hint {
    background: #eff5ff;
    color: #33527a;
}

.dressup-page .purchase-button {
    margin: 0;
    padding: 8px 12px;
    border: none;
    border-radius: 12px;
    background: #f0ad4e;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.dressup-page .purchase-button:hover {
    background: #e69539;
}

.dressup-page .browser-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.dressup-page .browser-note {
    margin: 0;
    color: #5c6c88;
    font-size: 0.92rem;
}

.dressup-page .browser-more {
    width: auto;
    max-width: none;
    min-width: 180px;
}

.dressup-page .action-row {
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 14px 35px rgba(63, 94, 174, 0.08);
}

.dressup-page .action-row .primary-button,
.dressup-page .action-row .secondary-button {
    width: 100%;
    max-width: none;
}

.dressup-page .saved-section {
    margin-top: 0;
}

.dressup-page .saved-gallery-section {
    padding: 20px;
}

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

.dressup-page .saved-section-head h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
}

.dressup-page .saved-section-head p {
    margin: 0;
    color: #5c6c88;
    line-height: 1.6;
}

.dressup-page .saved-section-badge {
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(79, 143, 232, 0.12);
    color: var(--accent);
    font-weight: 700;
}

.dressup-page .saved-gallery {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.dressup-page .saved-gallery .saved-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 12px 26px rgba(63, 94, 174, 0.08);
}

.dressup-page .saved-gallery .saved-item.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(79, 143, 232, 0.14), 0 12px 26px rgba(63, 94, 174, 0.10);
}

.dressup-page .saved-preview-card {
    width: 100%;
    display: grid;
    gap: 10px;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.dressup-page .saved-preview-card:focus-visible {
    outline: 3px solid rgba(79, 143, 232, 0.22);
    outline-offset: 3px;
    border-radius: 18px;
}

.dressup-page .saved-preview-frame {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    border: 1px solid rgba(209, 221, 233, 0.95);
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.62), transparent 42%),
        linear-gradient(180deg, #f8fbff 0%, #eef4fc 100%);
    overflow: hidden;
}

.dressup-page .saved-preview-frame img {
    width: 100%;
    height: 100%;
    border-radius: 0;
    object-fit: contain;
}

.dressup-page .saved-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.dressup-page .saved-layer--background { z-index: 0; }
.dressup-page .saved-layer--body { z-index: 2; }
.dressup-page .saved-layer--eyes { z-index: 3; }
.dressup-page .saved-layer--nose { z-index: 4; }
.dressup-page .saved-layer--mouth { z-index: 5; }
.dressup-page .saved-layer--shoes { z-index: 6; }
.dressup-page .saved-layer--bottoms { z-index: 7; }
.dressup-page .saved-layer--tops { z-index: 8; }
.dressup-page .saved-layer--onepiece { z-index: 9; }
.dressup-page .saved-layer--accessory1 { z-index: 10; }
.dressup-page .saved-layer--accessory2 { z-index: 11; }
.dressup-page .saved-layer--hair { z-index: 12; }

.dressup-page .saved-preview-caption {
    display: grid;
    gap: 4px;
}

.dressup-page .saved-preview-caption strong {
    font-size: 1rem;
    line-height: 1.35;
}

.dressup-page .saved-preview-caption span {
    color: #5c6c88;
    font-size: 0.9rem;
}

.dressup-page .saved-active-pill {
    display: inline-flex;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(79, 143, 232, 0.12);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
}

.dressup-page .saved-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dressup-page .saved-actions button {
    flex: 1 1 0;
    min-width: 72px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.dressup-page .saved-actions button:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
    background: #f4f8ff;
}

.dressup-page .saved-actions .saved-overwrite {
    background: rgba(79, 143, 232, 0.08);
}

.dressup-page .saved-actions .saved-saveas {
    background: #eef5ff;
}

.dressup-page .saved-actions .saved-delete {
    border-color: #f0b5b5;
    background: #fff3f3;
    color: #b13a3a;
}

.dressup-page .saved-actions .saved-delete:hover {
    border-color: #e47777;
    background: #ffe6e6;
}

.dressup-page .saved-empty {
    margin: 0;
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    color: #5c6c88;
    background: #f8fbff;
}

@media (max-width: 1100px) {
    .dressup-page .workspace-grid {
        grid-template-columns: 1fr;
    }

    .dressup-page .viewer {
        position: static;
        min-height: 620px;
    }
}

@media (max-width: 720px) {
    .dressup-page .workspace-section {
        padding: 18px;
    }

    .dressup-page .controls-intro {
        flex-direction: column;
    }

    .dressup-page .groups-panel {
        grid-template-columns: 1fr;
    }

    .dressup-page .browser-head,
    .dressup-page .browser-foot {
        flex-direction: column;
        align-items: stretch;
    }

    .dressup-page .browser-more {
        width: 100%;
    }

    .dressup-page .item-list {
        grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    }

    .dressup-page .viewer {
        min-height: 520px;
        padding: 18px;
    }

    .dressup-page .character-card {
        width: min(100%, 100%);
    }

    .dressup-page .saved-gallery {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}
