* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
}

.page {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.page.active {
    display: flex;
    opacity: 1;
}

/* 页面1: 加载页 */
#page-loading {
    position: relative;
    background-color: #dfdfdf;
    /* background-image: url('assets/images/bg-loading.jpg'); */
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-icon {
    width: 80px;
    height: 80px;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 18px;
    color: #8B4513;
    color: #5a5a5a;
    text-align: center;
    line-height: 1.6;
    transform: scaleY(1.3);
    letter-spacing: 2px;
}

.loading-num {
    font-size: 16px;
    color: #a7a7a7;
    font-weight: bold;
    transform: scaleY(1.3);
}

/* 页面2-6: 通用背景 */
#page-home,
#page-theme,
#page-pattern,
#page-edit,
#page-result {
    background-image: url('assets/images/bg-common.jpg');
}

/* 页面2: 首页轮播 */
#page-home {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    background-image: url('assets/images/bg-home.jpg');
}

.carousel-text {
    position: relative;
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

.carousel-text p {
    font-size: 16px;
    color: #8B4513;
    color: #e6e6e6;
    margin-bottom: 5px;
    letter-spacing: 2px;
    transform: scaleY(1.12);
}

.carousel-container {
    width: 90%;
    max-width: 500px;
    height: 60vh;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 40px;
}

.carousel-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.8s ease;
}

.carousel-wrapper .carousel-item {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.carousel-wrapper .carousel-item.active {
    opacity: 1;
}

.carousel-wrapper .carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-wrapper .carousel-item h2 {
    font-size: 24px;
    color: #8B4513;
    margin-top: 10px;
    margin-bottom: 20px;
    text-align: center;
}



/* 按钮样式 */
.btn-primary,
.btn-secondary {
    padding: 15px 50px;
    font-size: 18px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #D4AF37 0%, #C9A700 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
    background: white;
    color: #8B4513;
    border: 2px solid #D4AF37;
    margin-bottom: 15px;
}

.btn-primary:active,
.btn-secondary:active {
    transform: scale(0.95);
}

.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #3f3f3f;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 页面3: 主题选择 */
#page-theme {
    flex-direction: column;
    align-items: center;
    padding: 80px 20px 40px;
}

.theme-title {
    font-size: 24px;
    color: #8B4513;
    margin-bottom: 40px;
    text-align: center;
}

.theme-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 90%;
    max-width: 400px;
}

.theme-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.theme-card:active {
    transform: scale(0.98);
}

.theme-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.theme-name {
    padding: 0px 0 20px;
    font-size: 18px;
    color: #8B4513;
    text-align: center;
    line-height: 1.5;
}

.theme-name p {
    margin-bottom: 5px;
    padding-top: 10px;
}

.theme-name p:first-child {
    font-size: 22px;
    letter-spacing: 6px;
    transform: scaleY(1.52);
    display: inline-block;
    border-bottom: 1px solid #D4AF37;
}

.theme-name p:last-child {
    font-size: 16px;
    color: #000;
    letter-spacing: 2px;
    transform: scaleY(1.32);
}



/* 页面4: 图案选择 */
#page-pattern {
    flex-direction: column;
    align-items: center;
    padding: 80px 20px 20px;
    position: relative;
}

.pattern-hint-svg {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 320px;
    z-index: 10;
    animation: floatArc 2.5s ease-in-out infinite;
}

@keyframes floatArc {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(-12px);
    }
}

.pattern-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    margin-top: 70px;
}

.pattern-preview-circle {
    width: 280px;
    height: 280px;
    overflow: hidden;
    background: linear-gradient(135deg, #C9A700 0%, #D4AF37 50%, #C9A700 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.4);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.pattern-preview-circle:active {
    transform: scale(0.95);
}

.pattern-preview-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pattern-desc {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    margin-bottom: 10px;
    gap: 10px;
    transform: scale(0.6);
}

.pattern-name {
    font-size: 18px;
    color: #8B4513;
    letter-spacing: 6px;
    transform: scaleY(1.02);
    display: inline-block;
    border-right: 1px solid #D4AF37;
    padding: 8px;
    margin: 8px;
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.pattern-subtitle {
    font-size: 16px;
    color: #000;
    letter-spacing: 2px;
    transform: scaleY(1.32);
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.pattern-list-wrapper {
    width: 100%;
    height: 180px;
    height: 260px;
    /* overflow: hidden; */
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.pattern-list {
    position: relative;
    width: 320px;
    /* height: 200px; */
    transform: rotateZ(90deg);
}

.pattern-item {
    position: absolute;
    width: 85px;
    height: 85px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    border: 2px solid #D4AF37;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform-origin: center center;
}

.pattern-item.active {
    width: 125px;
    height: 125px;
    border-color: #D4AF37;
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.8);
    z-index: 10;
}

.pattern-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.pattern-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.pattern-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(139, 69, 19, 0.3);
    transition: all 0.3s ease;
}

.pattern-indicator-dot.active {
    background: #D4AF37;
    transform: scale(1.3);
}

/* 页面5: DIY编辑 */
#page-edit {
    flex-direction: column;
    padding: 0;
}

.result-header {
    display: flex;
    justify-content: flex-end;
    align-items: end;
    padding: 20px;
    width: 100%;
}

.edit-header {
    display: flex;
    justify-content: flex-end;
    align-items: end;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
}

.btn-done {
    padding: 10px 25px;
    background: #D4AF37;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 16px;
    cursor: pointer;
}

.edit-hint-top,
.edit-hint-bottom {
    font-size: 14px;
    color: #8B4513;
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.8);
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

#editCanvas {
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    touch-action: none;
}

/* 香调介绍文字 */
.fragrance-desc {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-width: 250px;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.fragrance-name {
    font-size: 18px;
    font-weight: bold;
    color: #8B4513;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 2px solid #D4AF37;
    padding-bottom: 8px;
}

.fragrance-notes {
    font-size: 14px;
    color: #333;
    line-height: 1.8;
}

.fragrance-notes div {
    margin-bottom: 8px;
    text-align: left;
}

.fragrance-notes div:last-child {
    margin-bottom: 0;
}

.edit-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    flex: 1;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
}

.tab.active {
    color: #8B4513;
    border-bottom: 3px solid #D4AF37;
    font-weight: bold;
}

.edit-content {
    height: 150px;
    background: rgba(255, 255, 255, 0.9);
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: block;
}

.element-list,
.color-list,
.fragrance-list {
    display: flex;
    gap: 10px;
    padding: 15px;
    overflow-x: auto;
    height: 100%;
    align-items: center;
}

.element-list::-webkit-scrollbar,
.color-list::-webkit-scrollbar,
.fragrance-list::-webkit-scrollbar {
    display: none;
}

.element-item,
.color-item,
.fragrance-item {
    min-width: 70px;
    height: 70px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
}

.element-item:active,
.color-item:active,
.fragrance-item:active {
    transform: scale(0.95);
}

.element-item.active,
.color-item.active,
.fragrance-item.active {
    border-color: #D4AF37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.element-item {
    position: relative;
}

.element-item .close-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #D4AF37;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    border: 2px solid white;
}

.element-item.active .close-btn {
    opacity: 1;
}

.element-item img,
.color-item img,
.fragrance-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 页面6: 成品展示 */
#page-result {
    flex-direction: column;
    align-items: center;
    padding: 0px 20px 40px;
}

.result-carrier {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    width: 100%;
}

#currentCarrier {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #D4AF37;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

#currentCarrier img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#currentCarrierTxt {
    flex: 1;
    writing-mode: vertical-rl;
    text-orientation: upright;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
}

#currentCarrierTxt p {
    margin: 0;
    font-size: 22px;
    color: #2c2c2c;
    letter-spacing: 2px;
    line-height: 1.5;
    transform-origin: top;
}

#currentCarrierTxt p:nth-child(1) {
    font-size: 20px;
    transform: scaleY(1.2);
}

#currentCarrierTxt p:nth-child(2) {
    font-size: 28px;
    transform: scaleX(0.8) scaleY(1.8);
    margin-top: -2px;
}

#currentCarrierTxt p:nth-child(3) {
    letter-spacing: 6px;
    font-size: 16px;
    transform: scale(0.8);
    color: #585858;
}

.result-container {
    width: 90%;
    max-width: 500px;
    margin-bottom: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

#resultCanvas {
    width: 100%;
    display: block;
}

.save-hint {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 16px;
    color: #8B4513;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    padding: 0 20px;
}

.fingerprint-icon {
    width: 30px;
    height: 30px;
}