* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f7efe3;
    --paper: #fffaf2;
    --paper-strong: #fff4df;
    --ink: #2d2118;
    --muted: #76665a;
    --border: rgba(82, 56, 35, 0.16);
    --terracotta: #a85234;
    --terracotta-dark: #74351f;
    --gold: #d79a46;
    --jade: #277568;
    --blue: #315d7e;
    --shadow: 0 18px 42px rgba(89, 52, 25, 0.16);
    --radius: 8px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
    min-height: 100%;
    font-size: 16px;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 18% 10%, rgba(215, 154, 70, 0.18), transparent 28vw),
        radial-gradient(circle at 88% 18%, rgba(39, 117, 104, 0.14), transparent 26vw),
        linear-gradient(180deg, #fbf4ea 0%, #f0ddc4 100%);
    -webkit-tap-highlight-color: transparent;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

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

.watermark {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.12;
}

.watermark-item {
    position: absolute;
    transform: rotate(-18deg);
    transform-origin: left top;
    color: #1c160f;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0;
    white-space: nowrap;
}

#app {
    min-height: 100vh;
}

.page {
    display: none;
    min-height: 100vh;
    position: relative;
}

.page.active {
    display: block;
}

.entry-shell {
    width: min(100%, 520px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 28px 18px calc(28px + var(--safe-bottom));
}

.brand-section {
    margin-bottom: 22px;
    text-align: center;
}

.brand-section h1 {
    color: var(--ink);
    font-size: 30px;
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: 0;
    text-align: center;
}

.hero-section {
    margin-top: 18px;
}

.hero-visual {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 8px;
}

.carousel {
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(116, 53, 31, 0.16);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.carousel-track {
    display: flex;
    transition: transform 360ms ease;
}

.carousel-item {
    position: relative;
    flex: 0 0 100%;
    aspect-ratio: 1 / 1;
    background: var(--paper-strong);
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.style-label {
    position: absolute;
    left: 12px;
    bottom: 12px;
    padding: 7px 12px;
    border-radius: 999px;
    color: #fff;
    background: rgba(45, 33, 24, 0.72);
    font-size: 13px;
    font-weight: 700;
}

.carousel-btn,
.icon-btn,
.voice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    color: #fff;
    background: var(--terracotta);
}

.carousel-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    box-shadow: 0 10px 22px rgba(116, 53, 31, 0.18);
}

.carousel-btn svg {
    display: block;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.carousel-indicators {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 14px 0 20px;
}

.indicator {
    width: 8px;
    height: 8px;
    border: 0;
    border-radius: 999px;
    background: rgba(116, 53, 31, 0.28);
    transition: width 180ms ease, background 180ms ease;
}

.indicator.active {
    width: 24px;
    background: var(--terracotta);
}

.preference-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: rgba(255, 250, 242, 0.88);
    box-shadow: 0 12px 32px rgba(89, 52, 25, 0.08);
    backdrop-filter: blur(12px);
}

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

.section-title span {
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
}

.section-title strong {
    flex-shrink: 0;
    color: var(--jade);
    font-size: 13px;
    font-weight: 700;
}

.depth-title {
    margin-top: 18px;
}

.style-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.style-card {
    min-width: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: var(--radius);
    color: var(--ink);
    background: #fff;
    box-shadow: 0 6px 18px rgba(89, 52, 25, 0.08);
    transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.style-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.style-card span {
    display: block;
    padding: 8px 4px 9px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.style-card.selected {
    border-color: var(--terracotta);
    box-shadow: 0 10px 24px rgba(168, 82, 52, 0.22);
    transform: translateY(-2px);
}

.style-card.selected span {
    color: var(--terracotta-dark);
}

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

.radio-label {
    display: block;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 12px;
    background: #fff;
    transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.radio-label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-name,
.hint {
    display: block;
    letter-spacing: 0;
}

.radio-name {
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.35;
}

.hint {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.radio-label.active {
    border-color: var(--jade);
    background: rgba(39, 117, 104, 0.08);
    box-shadow: inset 0 0 0 1px rgba(39, 117, 104, 0.08);
}

.action-btn {
    width: 100%;
    min-height: 52px;
    margin-top: 16px;
    border: 0;
    border-radius: var(--radius);
    color: #fff;
    background: linear-gradient(135deg, var(--terracotta) 0%, var(--terracotta-dark) 58%, #5e2d1d 100%);
    box-shadow: 0 14px 30px rgba(116, 53, 31, 0.24);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0;
}

.carousel-btn:active,
.style-card:active,
.radio-label:active,
.action-btn:active,
.quick-btn:active,
.send-btn:active,
.voice-btn:active,
.style-switch:active,
.back-btn:active {
    transform: scale(0.98);
}

.page-chat {
    height: 100vh;
    overflow: hidden;
    background:
        linear-gradient(rgba(252, 244, 232, 0.92), rgba(244, 225, 198, 0.94)),
        repeating-linear-gradient(45deg, rgba(168, 82, 52, 0.05) 0 1px, transparent 1px 16px);
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 68px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    border-bottom: 1px solid rgba(116, 53, 31, 0.16);
    background: rgba(255, 250, 242, 0.92);
    backdrop-filter: blur(16px);
}

.icon-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.icon-btn svg,
.voice-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.avatar-container {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
    gap: 10px;
}

.avatar-container img {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 2px solid #fff;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 8px 18px rgba(89, 52, 25, 0.16);
}

.avatar-container .name,
.avatar-container .status {
    display: block;
    line-height: 1.25;
    white-space: nowrap;
}

.avatar-container .name {
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
}

.avatar-container .status {
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
}

.style-switch {
    flex: 0 0 auto;
    min-height: 34px;
    border: 1px solid rgba(168, 82, 52, 0.22);
    border-radius: 999px;
    padding: 0 12px;
    color: var(--terracotta-dark);
    background: rgba(168, 82, 52, 0.08);
    font-size: 13px;
    font-weight: 700;
}

.chat-container {
    height: calc(100vh - 68px - 114px - var(--safe-bottom));
    overflow-y: auto;
    padding: 18px 14px 12px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
}

.bot-message {
    justify-content: flex-start;
}

.user-message {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
}

.msg-content {
    max-width: min(78%, 430px);
    border: 1px solid rgba(116, 53, 31, 0.08);
    border-radius: var(--radius);
    padding: 11px 13px;
    box-shadow: 0 8px 22px rgba(89, 52, 25, 0.08);
}

.bot-message .msg-content {
    color: var(--ink);
    background: rgba(255, 250, 242, 0.96);
}

.user-message .msg-content {
    color: #fff;
    background: var(--blue);
    border-color: rgba(49, 93, 126, 0.25);
}

.msg-content p {
    color: inherit;
    font-size: 15px;
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-wrap;
}

.quick-questions {
    display: flex;
    gap: 8px;
    width: 100%;
    overflow-x: auto;
    padding: 0 14px 10px;
}

.quick-btn {
    flex: 0 0 auto;
    max-width: 82vw;
    min-height: 34px;
    border: 1px solid rgba(39, 117, 104, 0.2);
    border-radius: 999px;
    padding: 0 12px;
    color: var(--jade);
    background: rgba(255, 250, 242, 0.92);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.input-section {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 62px;
    align-items: center;
    gap: 8px;
    padding: 10px 14px calc(10px + var(--safe-bottom));
    border-top: 1px solid rgba(116, 53, 31, 0.12);
    background: rgba(255, 250, 242, 0.94);
    backdrop-filter: blur(16px);
}

.voice-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--jade);
}

.input-section input {
    width: 100%;
    height: 42px;
    min-width: 0;
    border: 1px solid rgba(116, 53, 31, 0.18);
    border-radius: 999px;
    padding: 0 14px;
    color: var(--ink);
    background: #fff;
    outline: none;
    font-size: 15px;
}

.input-section input:focus {
    border-color: var(--terracotta);
    box-shadow: 0 0 0 3px rgba(168, 82, 52, 0.12);
}

.send-btn {
    height: 42px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: var(--terracotta);
    font-size: 14px;
    font-weight: 800;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 58px;
    min-height: 42px;
    border: 1px solid rgba(116, 53, 31, 0.08);
    border-radius: var(--radius);
    padding: 0 13px;
    background: rgba(255, 250, 242, 0.96);
    box-shadow: 0 8px 22px rgba(89, 52, 25, 0.08);
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--terracotta);
    animation: typing 1.1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing {
    0%, 80%, 100% {
        opacity: 0.35;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

::-webkit-scrollbar {
    width: 0;
    height: 0;
}

@media (min-width: 760px) {
    body {
        background:
            radial-gradient(circle at 18% 10%, rgba(215, 154, 70, 0.18), transparent 340px),
            radial-gradient(circle at 88% 18%, rgba(39, 117, 104, 0.14), transparent 320px),
            linear-gradient(180deg, #fbf4ea 0%, #f0ddc4 100%);
    }

    .entry-shell {
        width: min(100%, 980px);
        display: grid;
        grid-template-columns: minmax(0, 1fr) 390px;
        grid-template-areas:
            "brand hero"
            "prefs hero"
            "button hero";
        align-content: center;
        gap: 18px 32px;
        padding: 42px 24px;
    }

    .brand-section {
        grid-area: brand;
        margin: 0;
    }

    .brand-section h1 {
        font-size: 42px;
    }

    .hero-section {
        grid-area: hero;
        align-self: center;
        margin: 0;
    }

    .preference-section {
        grid-area: prefs;
    }

    .action-btn {
        grid-area: button;
        margin-top: 0;
    }

    .page-chat {
        width: min(100%, 920px);
        margin: 0 auto;
        border-right: 1px solid rgba(116, 53, 31, 0.12);
        border-left: 1px solid rgba(116, 53, 31, 0.12);
        box-shadow: 0 0 48px rgba(89, 52, 25, 0.12);
    }
}

@media (max-width: 360px) {
    .entry-shell {
        padding-right: 12px;
        padding-left: 12px;
    }

    .hero-visual {
        grid-template-columns: 36px minmax(0, 1fr) 36px;
    }

    .carousel-btn {
        width: 36px;
        height: 36px;
    }

    .brand-section h1 {
        font-size: 26px;
    }

    .quick-btn {
        font-size: 12px;
    }

    .chat-container {
        padding-right: 10px;
        padding-left: 10px;
    }
}
