:root {
    color-scheme: light;
    --bg: #fff7fb;
    --bg-soft: #f4fbff;
    --surface: #ffffff;
    --surface-rose: #fff0f5;
    --surface-mint: #effcf8;
    --text: #151729;
    --muted: #73788f;
    --subtle: #a6abba;
    --line: #f2ceda;
    --line-cool: #d9eef0;
    --accent: #ee426f;
    --accent-strong: #df2b61;
    --coral: #ff6a3d;
    --violet: #8d72dd;
    --mint: #3eaa95;
    --shadow: 0 18px 45px rgba(219, 73, 116, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: linear-gradient(
        180deg,
        var(--bg) 0%,
        #ffffff 44%,
        var(--bg-soft) 100%
    );
}

body {
    min-height: 100%;
    margin: 0;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "PingFang SC",
        "Hiragino Sans GB",
        "Microsoft YaHei",
        sans-serif;
    color: var(--text);
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.app-shell {
    width: min(100%, 880px);
    margin: 0 auto;
    padding: 16px 18px 88px;
}

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

.brand {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.brand-main {
    color: var(--accent);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0;
}

.privacy-mark {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 5px;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
}

.privacy-mark svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.intro {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.intro-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 11px;
    background: #ffe1eb;
    color: var(--accent);
}

.intro-icon svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(20px, 4.8vw, 26px);
    line-height: 1.16;
    font-weight: 900;
    letter-spacing: 0;
}

h2 {
    font-size: 16px;
    line-height: 1.25;
    font-weight: 900;
    letter-spacing: 0;
}

.intro p,
.share-panel p,
.unlock-panel p,
.footer {
    color: var(--muted);
    line-height: 1.65;
}

.intro p {
    margin-top: 8px;
    font-size: 15px;
}

.intro p:empty {
    display: none;
}

.steps-overview {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 4px 0 14px;
    padding: 2px 0 0;
}

.steps-overview::before {
    position: absolute;
    top: 13px;
    right: 11%;
    left: 11%;
    height: 2px;
    border-radius: 999px;
    background: #f0d9e0;
    content: "";
}

.steps-overview div {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 44px;
    align-items: center;
    justify-items: center;
    gap: 5px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.steps-overview div[aria-current="step"] {
    color: var(--accent-strong);
}

.steps-overview div[aria-current="step"] span {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 5px rgba(238, 66, 111, 0.12);
}

.steps-overview span {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    place-items: center;
    border: 2px solid #f2ceda;
    border-radius: 50%;
    background: #fff;
    color: var(--accent-strong);
    font-size: 11px;
    line-height: 1;
}

.notice {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    left: 50%;
    z-index: 20;
    width: min(calc(100% - 32px), 420px);
    padding: 11px 14px;
    border: 1px solid rgba(204, 238, 232, 0.92);
    border-radius: 999px;
    background: rgba(239, 252, 248, 0.96);
    box-shadow: 0 14px 34px rgba(62, 170, 149, 0.18);
    color: #227f70;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.35;
    text-align: center;
    transform: translateX(-50%);
    backdrop-filter: blur(16px);
}

.notice[data-tone="error"] {
    border-color: rgba(241, 195, 207, 0.96);
    background: rgba(255, 240, 245, 0.96);
    box-shadow: 0 14px 34px rgba(197, 54, 89, 0.16);
    color: #c53659;
}

.history-section,
.tool-section,
.result-section,
.share-panel {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid rgba(242, 206, 218, 0.72);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

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

.history-row,
.history-empty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 48px;
    padding: 10px 11px;
    border: 1px solid #f0d9e0;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    text-decoration: none;
}

.history-row strong,
.history-row small {
    display: block;
}

.history-row strong {
    font-size: 14px;
    font-weight: 900;
}

.history-row small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.history-actions {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
}

.history-status {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 999px;
    padding: 0 9px;
    flex-shrink: 0;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 900;
}

.history-status.matched {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 8px 18px rgba(238, 66, 111, 0.22);
}

.history-status svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.history-status svg path + path {
    fill: none;
    stroke: #fff;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.4;
}

.history-delete {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    border: 1px solid #f1d4de;
    border-radius: 9px;
    background: #fff;
    color: #c53659;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    padding: 0 9px;
}

.history-empty {
    justify-content: flex-start;
    color: var(--muted);
    line-height: 1.5;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 9px;
}

.section-head span,
#modeTag,
#matchCount {
    flex-shrink: 0;
    color: var(--mint);
    font-size: 12px;
    font-weight: 900;
}

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

.theme-group {
    display: grid;
    gap: 7px;
}

.theme-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text);
}

.theme-title span {
    font-size: 14px;
    font-weight: 900;
}

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

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

.wish-item {
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    min-height: 48px;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid #f0d9e0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--text);
    transition:
        border-color 0.16s ease,
        background 0.16s ease,
        transform 0.16s ease;
}

.wish-item:hover {
    border-color: #f2a6bd;
}

.wish-item.like {
    border-color: #f2a2b9;
    background: linear-gradient(135deg, #fff0f5 0%, #fff9fb 100%);
}

.wish-item.dislike {
    border-color: #d7dce7;
    background: #fbfcff;
}

.wish-icon {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 9px;
    background: #fde8ef;
    color: var(--accent);
    font-size: 15px;
    font-weight: 900;
}

.wish-item:nth-child(4n + 2) .wish-icon {
    background: #f0ebff;
    color: var(--violet);
}

.wish-item:nth-child(4n + 3) .wish-icon {
    background: #eaf8f6;
    color: var(--mint);
}

.wish-name {
    overflow: hidden;
    min-width: 0;
    font-size: 14px;
    font-weight: 850;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wish-item.image-mode {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 4px;
}

.wish-item.image-mode .choice-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wish-item.image-mode .choice-btn {
    width: 100%;
    height: 30px;
    border-radius: 9px;
}

.match-item {
    cursor: default;
}

.match-item.image-mode .match-status {
    grid-column: 1 / -1;
    width: 100%;
    height: 30px;
    border-radius: 9px;
}

.match-status {
    display: inline-flex;
    width: 70px;
    height: 32px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.match-status svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.wish-image-wrap {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    background: #fff8fb;
}

.wish-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wish-image-label {
    position: absolute;
    right: 8px;
    bottom: 8px;
    left: 8px;
    overflow: hidden;
    padding: 5px 7px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pose-grid .wish-image-label {
    overflow: visible;
    font-size: 12px;
    line-height: 1.15;
    text-overflow: clip;
    white-space: normal;
}

.choice-actions {
    display: grid;
    grid-template-columns: repeat(2, 32px);
    gap: 6px;
}

.choice-btn {
    display: grid;
    width: 32px;
    height: 32px;
    min-height: 0;
    place-items: center;
    border: 1px solid #e8dce3;
    border-radius: 50%;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
}

.choice-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
}

.choice-btn.like svg {
    fill: currentColor;
    stroke-width: 0;
}

.choice-btn.dislike svg {
    fill: currentColor;
    stroke-width: 0;
}

.choice-btn.like[aria-pressed="true"] {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.choice-btn.dislike[aria-pressed="true"] {
    border-color: #697181;
    background: #697181;
    color: #fff;
}

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

.custom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px dashed #88d3c7;
    border-radius: 14px;
    background: rgba(239, 252, 248, 0.8);
    color: #246d61;
    font-weight: 850;
}

.custom-row button {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(62, 170, 149, 0.1);
    color: #2c8d7d;
    cursor: pointer;
}

.custom-empty {
    padding: 12px 14px;
    border: 1px dashed #d8dce7;
    border-radius: 14px;
    color: var(--muted);
}

.custom-form {
    display: flex;
    gap: 8px;
    margin-top: 9px;
}

.custom-form input,
.share-box input {
    min-width: 0;
    flex: 1;
    height: 40px;
    border: 1px solid #e5dbe2;
    border-radius: 11px;
    background: #fff;
    color: var(--text);
    outline: none;
    padding: 0 12px;
    font-size: 14px;
}

.custom-form input:focus,
.share-box input:focus {
    border-color: #f09bb8;
    box-shadow: 0 0 0 4px rgba(238, 66, 111, 0.1);
}

.custom-form button,
.share-box button,
.primary,
.secondary,
.danger,
.pay-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
}

.custom-form button,
.primary,
.pay-link {
    background: linear-gradient(135deg, var(--accent) 0%, var(--coral) 100%);
    color: #fff;
    box-shadow: 0 14px 28px rgba(238, 66, 111, 0.24);
}

.custom-form button {
    width: 64px;
    flex: 0 0 auto;
}

.share-panel {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: 10px;
}

.share-panel h2 {
    margin-bottom: 0;
}

.share-box {
    display: flex;
    gap: 8px;
}

.share-box button,
.secondary {
    border: 1px solid #f1d4de;
    background: #fff;
    color: var(--accent-strong);
}

.danger {
    border: 1px solid #f1c3cf;
    background: #fff;
    color: #c53659;
}

.share-box button {
    width: 62px;
    flex: 0 0 auto;
}

.match-list,
.full-list {
    display: grid;
    gap: 8px;
}

.full-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    padding: 10px 11px;
    border-radius: 11px;
    font-weight: 850;
    font-size: 14px;
}

.full-row {
    border: 1px solid #ede9f8;
    background: #fbfaff;
    color: #4b4660;
}

.empty-state {
    padding: 12px;
    border: 1px dashed #d9dce8;
    border-radius: 11px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.unlock-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    padding: 11px;
    border: 1px solid #cceee8;
    border-radius: 11px;
    background: rgba(239, 252, 248, 0.9);
}

.unlock-panel strong {
    color: #217768;
}

.unlock-panel p {
    margin-top: 2px;
    font-size: 12px;
}

.pay-link {
    min-width: 108px;
    padding: 0 12px;
    white-space: nowrap;
}

.action-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px max(16px, env(safe-area-inset-left))
        calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(242, 206, 218, 0.76);
    background: rgba(255, 248, 251, 0.9);
    backdrop-filter: blur(18px);
    box-shadow: 0 -18px 34px rgba(219, 73, 116, 0.09);
}

.action-bar button,
.action-bar .action-link {
    width: min(190px, calc(50vw - 22px));
}

.action-bar .danger {
    width: min(108px, 24vw);
}

.primary:disabled,
.secondary:disabled,
.danger:disabled,
.custom-form button:disabled,
.pay-link[aria-disabled="true"],
.history-delete:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    justify-content: center;
    margin-top: 18px;
    font-size: 12px;
    text-align: center;
}

.footer a {
    color: var(--accent-strong);
    font-weight: 800;
    text-decoration: none;
}

[hidden] {
    display: none !important;
}

@media (max-width: 720px) {
    .app-shell {
        padding: 14px 12px 82px;
    }

    .topbar {
        align-items: flex-start;
    }

    .brand {
        flex-direction: column;
        gap: 0;
    }

    .theme-grid,
    .share-panel {
        grid-template-columns: 1fr;
    }

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

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

    .steps-overview {
        margin-top: 2px;
        margin-bottom: 12px;
    }

    .steps-overview::before {
        top: 12px;
        right: 10%;
        left: 10%;
    }

    .steps-overview div {
        min-height: 40px;
        font-size: 10px;
    }

    .steps-overview span {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .wishlist-grid {
        gap: 9px;
    }

    .wish-item {
        min-height: 48px;
    }

    .wish-item.image-mode {
        min-height: 0;
    }

    .wish-image-label {
        right: 5px;
        bottom: 5px;
        left: 5px;
        padding: 4px 5px;
        font-size: 12px;
    }

    .unlock-panel,
    .share-box,
    .custom-form {
        align-items: stretch;
        flex-direction: column;
    }

    .pay-link,
    .share-box button,
    .custom-form button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
