@font-face {
    font-family: 'AIAEverest';
    src: url('fonts/AIAEverest-Regular.ttf') format('truetype'),
         url('fonts/AIAEverest-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'AIAEverest';
    src: url('fonts/AIAEverest-Medium.ttf') format('truetype'),
         url('fonts/AIAEverest-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'AIAEverest';
    src: url('fonts/AIAEverest-Bold.ttf') format('truetype'),
         url('fonts/AIAEverest-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: 'AIAEverest';
    src: url('fonts/AIAEverest-ExtraBold.ttf') format('truetype'),
         url('fonts/AIAEverest-ExtraBold.otf') format('opentype');
    font-weight: 800;
    font-style: normal;
}
@font-face {
    font-family: 'AIAEverest';
    src: url('fonts/AIAEverest-Condensed.ttf') format('truetype'),
         url('fonts/AIAEverest-Condensed.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}
@font-face {
    font-family: 'AIAEverest';
    src: url('fonts/AIAEverest-CondensedMedium.ttf') format('truetype'),
         url('fonts/AIAEverest-CondensedMedium.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'AIAEverest', 'Noto Sans TC', 'Segoe UI', Arial, sans-serif; background: #fff; color: #333; }

/* ── Header ── */
.site-header {
    background: white;
    height: 75px;
    display: flex;
    align-items: stretch;
    padding: 8px 8px 0 8px;
    border-bottom: 1px solid #eee;
    max-width: 1440px;
    margin: 0 auto;
}
.aia-logo{
    width: 40px;
    margin-right:15px;
    margin-left:15px;
}
.header-red-ctn{
    position: relative;
    z-index: 2;
    display: flex;
}
.header-pink-ctn{
    position: relative;
    z-index: 1;
    display: flex;
    margin-left: -80px;
}
.header-red {
    background: #D31145;
    color: white;
    padding: 8px 32px 8px 16px;
    text-transform: uppercase;
    display: flex;
    gap:16px;
    align-items: center;
    white-space: nowrap;
    border-radius: 10px 18px 0px 0;
}
.header-red h1{
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
}
.header-triangle {
    width: 0;
    height: 0;
    border-top: 58px solid transparent;
    border-bottom: 0px solid transparent;
    border-left: 25px solid #D31145;
    flex-shrink: 0;
    align-self: center;
    top: 4px;
    position: relative;
    left: -3px;
}
.header-pink {
    background: #FEE4E7;
    color: white;
    padding: 0 32px 0 40px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    white-space: nowrap;
    border-radius: 10px 18px 0px 0;
}
.header-triangle-pink {
    width: 0;
    height: 0;
    border-top: 58px solid transparent;
    border-bottom: 0px solid transparent;
    border-left: 25px solid #FEE4E7;
    flex-shrink: 0;
    align-self: center;
    top: 4px;
    position: relative;
    left: -3px;
}
.header-stripe {
    width: 52px;
    margin-left: -16px;
    background: #F2B3C2;
    clip-path: polygon(0 0, 100% 0, calc(100% - 32px) 100%, 0 100%);
    flex-shrink: 0;
}

/* ── Hero ── */
.hero {
    padding: 16px 0 0 0;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: start;
    height:480px;
    max-width: 1440px;
}
.hero_left{
position: relative;
    z-index: -1;
    width: 25%;
    background-image: url('images/hero-left-m.png');
    background-size: cover;
    display: block;
    height: 100%;
    background-repeat: no-repeat;
    background-position: right top;
}
.hero_text{
    padding:40px 0;
    width: 40%;
}
.hero_rights{
    display: flex;
    width: 30%;
    align-items: center;
    height: 100%;
    justify-content: center;
}
.hero_right {
    width: 33.3%;
    text-align: center;;
}
.hero_right img {
    height: 100%;
    max-height: 400px;
}
.hero h2 { font-size: 52px; font-weight: 800; color: #1A1A2E; line-height: 1.1; }
.hero h1 { font-size: 54px; font-weight: 800; color: #D31145; line-height: 1.1; }
.hero p { margin-top: 20px; color: #6B6B80; font-size: 16px; line-height: 1.7; max-width: 520px; }
.btn-start {
    display: flex; justify-content: center; margin: 30px auto 0 auto;
    background: #D31145; color: white; border: none;
    padding: 14px 32px; border-radius: 12px; font-size: 16px;
    font-weight: 500; cursor: pointer;
}
.btn-start:hover { background: #D31145; }

/* ── Steps overview ── */
.steps-band { background: #F5F5F7; padding: 56px 80px; }
.steps-band h2 { text-align: center; font-size: 32px; font-weight: 700; color: #D31145; margin-bottom: 36px; }
.steps-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;margin: 0 auto;    max-width: 1440px;
}
.step-card { background: white; border-radius: 14px; padding: 28px 20px; text-align: left;border:1px solid rgba(0,0,0,0.08) }
.step-num { font-size: 30px; font-weight: 800; color: #FECACE; line-height: 1; }
.step-title { font-size: 20px; font-weight: 700; color:#1A1A2E; margin: 12px 0 12px; }
.step-desc { font-size: 12px; font-weight: 500; color: #6B6B80; line-height: 1.5; }

/* ── Generic section wrapper ── */
.section { padding: 72px 80px; margin: 0 auto;     max-width: 1440px;}
.section-header { display: flex; align-items: start; gap: 16px; margin-bottom: 32px; }
.section-num { font-size: 48px; font-weight: bold; color: #fecace; line-height: 1; }
.section-title { font-size: 32px; font-weight: bold; color:#D31145 }
.section-sub { font-size: 14px; color: #6B6B80; font-weight: normal; margin-top: 8px;}

.items-band .section-num{ color:#D31145;}
/* ── Personality cards ── */
.personality-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.p-carousel-nav { display: none; }

.p-card {
    border: 2px solid #ececec; border-radius: 18px; padding: 26px 22px;
    display: flex; flex-direction: column; cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    /* needed for snap on mobile */
    scroll-snap-align: start;
    flex-shrink: 0;
}
.p-card-title{
    display: flex;
    flex-direction: row;
    gap:16px;
    align-items: center;
}
.p-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.p-card.selected { box-shadow: 0 4px 24px rgba(0,0,0,0.12); }

/* per-type colours */
.p-card.protector  { --c: #D31145; }
.p-card.planner    { --c: #CAAF78; }
.p-card.aspirer    { --c: #4C4794; }
.p-card.motivator  { --c: #6B6B80; }
.p-card.selected   { border-color: var(--c); }

.p-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
}
.protector .p-icon  { background: #FECACE; }
.planner   .p-icon  { background: #F3EFE4; }
.aspirer   .p-icon  { background: #DBDAEA; }
.motivator .p-icon  { background: #D6D8DA; }

.p-type {
    font-size: 24px; font-weight: 700;
    text-transform: uppercase; color: var(--c);
}
.p-type-name{
    line-height: 1.1;
}
.p-name { font-size: 24px; font-weight: 700;color: var(--c); margin-top:3px;}
.p-desc { font-size: 14px; color: #777; line-height: 1.6; flex: 1; margin-top: 6px; }

.p-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px 0; }
.p-tag {
    font-size: 16px; padding: 4px 11px; border-radius: 20px;
    background: color-mix(in srgb, var(--c) 10%, white);
    color: var(--c); font-weight: 500;
    border: 1px solid var(--c);
}

.p-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: #F5F4F2;
    font-size: 13px;
    cursor: pointer;
    color: #6B6B80;
    font-weight: 500;
    transition: all 0.2s;
    margin-top: 16px;
}
.p-card.selected .p-btn { background: var(--c); color: white; border-color: var(--c); }

/* ── Form section ── */
.form-grid { display: grid; grid-template-columns: 0.5fr 0.5fr; gap: 32px; align-items: start; }
.form-label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 8px; }
.required { color: #D0021B; }
.form-input {
    width: 100%; padding: 12px 16px;     border: 1px solid #6B6B80;
    border-radius: 10px; font-size: 14px; margin-bottom: 24px; outline: none;
    transition: border-color 0.2s;background: #F5F5F7;    text-transform: uppercase;
}
.form-input:focus { border-color: #D0021B; }
#genderInput {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 44px;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='8' viewBox='0 0 14 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L7 7L13 1' stroke='%236B6B80' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
}

.upload-area {
    border: 2px dashed #ddd; border-radius: 14px;
    padding: 48px 24px; text-align: center; cursor: pointer;
    transition: border-color 0.2s;
}
.upload-area:hover { border-color: #D0021B; }
.upload-icon { font-size: 38px; color: #ccc; margin-bottom: 12px; }
.upload-main { font-size: 14px; color: #1A1A2E; }
.upload-hint { font-size: 12px; color: #6B6B80; margin-top: 8px; }
.upload-pick-btn {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 16px; padding: 8px 20px;
    border: 1.5px solid #ddd; border-radius: 8px;
    font-size: 13px; color: #555; background: white; cursor: pointer;
}
#imageInput { display: none; }
#uploadPreview { display: none; }
#previewImg { max-height: 200px; max-width: 100%; border-radius: 10px; }
#previewName { font-size: 12px; color: #999; margin-top: 8px; }

/* Tips panel */
.tips-panel { background: #FEE4E7; border-radius: 16px; padding: 25px; border: 1px solid #D31145; }
.tips-title { display: flex; gap: 8px; font-size: 20px; font-weight: 700; color: #1A1A2E; margin-bottom: 18px; }
.tip-row { display: flex; align-items:start; gap: 10px; margin-bottom: 14px; font-size: 14px; color: #555; line-height: 1.5; }
.tip-dot { color: #D0021B; font-weight: bold; flex-shrink: 0; margin-top: 4px;font-size: 8px; font-family: 'AIAEverest';}
.tip-text{ color:#6B6B80;}
.tip-bold { font-weight: 600; color: #1A1A2E; }
.tips-note { font-size: 12px; color: #6B6B80; margin-top: 18px; padding-top: 16px; border-top: 1px solid #00000014 ; }

/* ── Section 02: Items ── */
.items-band { background: #fecace; }
.items-counter {
    display: inline-flex; align-items: center; gap: 4px;
    background: #D31145; color: white;
    font-size: 13px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    margin-left: 12px; vertical-align: middle;
}
.items-counter span { opacity: 0.7; }
.items-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr; gap: 12px;
}
.item-card img {
    max-width: 100%;
}
.items-grid .item-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 6px);
}
.item-card {
    display: flex; align-items: center; gap: 14px;
    border: 1.5px solid #e0e0e0; border-radius: 12px;
    padding: 14px 18px; cursor: pointer; background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    user-select: none;
}
.item-card:hover { border-color: #D31145; }
.item-card.selected { border-color: #D31145; box-shadow: 0 2px 12px rgba(211,17,69,0.12); }
.item-radio {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid #ddd; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s, background 0.2s;
}
.item-card.selected .item-radio {
    border-color: #D31145; background: #D31145;
}
.item-radio::after {
    content: ''; width: 8px; height: 8px; border-radius: 50%;
    background: white; display: none;
}
.item-card.selected .item-radio::after { display: block; }
.item-text-zh { font-size: 14px; font-weight: 500; color: #1A1A2E; line-height: 1.3; }
.item-text-en { font-size: 15px; color: #1A1A2E;    margin-top: 2px;font-weight: 500; }

/* ── Generate section ── */
.gen-band { background: #FFFFFF; }
.gen-section { padding: 72px 80px; margin: 0 auto; max-width: 1440px; }

.preview-box {
    background: #F5F5F7; border-radius: 18px; min-height: 340px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;border: 2px dashed #ddd;
    padding:25px;
}
.preview-placeholder { text-align: center; padding: 25px; color: #bbb; }
.preview-placeholder .spark { font-size: 38px; margin-bottom: 14px; }
.preview-placeholder p { font-size: 14px; color:#6B6B80;}

.preview-placeholder .hint { font-size: 12px; color: rgba(107, 107, 128, 0.7); margin-top: 8px;  }

/* Magazine result (scaled to fit) */
.magazine-scaler {
    display: none;
    width: 100%; 
    /* overflow: hidden; */
    display: none; justify-content: center; padding: 20px;
}
#resultMagazine {
    width: 794px; height: 1113px;
    background-image: url('images/protector-background.png');
    background-size: 100% 100%; background-repeat: no-repeat;
    position: relative; flex-shrink: 0;
    transform-origin: top center;
}
#resultImg { position: absolute; height: 800px; bottom: 50px; left: 50%; transform: translateX(-50%); z-index: 10; }
#characterHeader { position: absolute; top: 0; left: 0; width: 100%; display: none; }
#characterHeader .header-name {     
text-transform: uppercase;
    width: 260px;
    position: absolute;
    top: 30px;
    left: 24%;
    color: #000000;
    font-size: 48px;
    max-width: 260px;
    line-height: 1.1;
    text-align: left;
    font-weight: bold;
    overflow: hidden;
    word-wrap: break-word;
    display: flex;
    align-items: center;
    height: 115px;
    overflow: hidden;
}
#characterInfo { position: absolute; display: none; top: 160px; left: 21%; width: 550px; }
#characterInfo .char-name { text-transform: uppercase; font-size: 22px; font-family:"AIAEverest"; font-weight: normal; color: #231f20; position: absolute; top: 13px; left: 6%; width:180px; display: flex; align-items: center; height: 55px;}
#characterInfo .char-personality { text-transform: uppercase; position: absolute; font-size: 14px; color: #231f20; line-height: 1.4; left: 70%; top: 29px; text-align: center; }
#magazineItems {
    position: absolute;
    display: none;
    gap: 20px;
    align-items: center;
    justify-content: center;
    right: 10%;
    flex-direction: column;
    top: 32%;
}
#magazineItems img {
    width: 210px;
    height: 119px;
    object-fit: contain;
}
#characterInfo .char-personality-title { font-weight: normal; color: #231f20; font-size:18px }

#loading { display: none; text-align: center; margin: 16px 0; color: #D0021B; font-weight: bold; font-size: 15px; }

.gen-btn {
    display: flex; gap:8px; margin: 28px auto 0;
    background: #D31145; color: white; border: none;
    padding: 18px 56px; border-radius: 16px; font-size: 16px;
    font-weight: 700; cursor: pointer; transition: background 0.2s;
    align-items: center; justify-content: center; text-align: center;
}
.gen-btn:hover { background: #a80016; }
.gen-btn:disabled { background: #ccc; cursor: not-allowed; }
.loading-dots {
    display: inline-flex;
    width: 18px;
    justify-content: flex-start;
}
.loading-dots span {
    display: inline-block;
    animation: loading-dot-bounce 1s infinite ease-in-out;
}
.loading-dots span:nth-child(2) {
    animation-delay: 0.15s;
}
.loading-dots span:nth-child(3) {
    animation-delay: 0.3s;
}
@keyframes loading-dot-bounce {
    0%, 80%, 100% {
        opacity: 0.35;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.button-group {
    display: flex; gap: 12px; align-items: center; justify-content: center;  margin: 16px auto 0px auto; 
}
.button-group .gen-btn {
    margin: 0;
}

.reset-btn {
    display: flex; gap: 8px;
    background: #666; color: white; border: none;
    padding: 18px 32px; border-radius: 16px; font-size: 16px;
    font-weight: 700; cursor: pointer; transition: background 0.2s;
    align-items: center; justify-content: center; text-align: center;
}
.reset-btn:hover { background: #444; }

.gen-hint { text-align: center; font-size: 12px; color: #bbb; margin-top: 10px; margin-bottom: 24px;}

/* Advanced prompt */
details.advanced { margin-top: 24px; }
details.advanced summary { font-size: 13px; color: #fff; cursor: pointer; font-weight: 600; }
details.advanced textarea {
    width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #ddd;
    font-family: monospace; font-size: 12px; margin-top: 10px; resize: vertical;
}

/* ── Footer ── */
.site-footer {
    background: #F5F5F7; color: #6B6B80; padding: 24px 80px;
    font-size: 11px; display: flex; justify-content: space-between;
    align-items: center; gap: 24px; flex-wrap: wrap;
    border-top: 1px solid #00000014;
    flex: 1 1 50%;
}
.footer-left{
    display: flex;
    gap: 16px;
    align-items: center;
    width: 50%;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    .steps-band { padding: 48px 32px; }
    .steps-grid { grid-template-columns: repeat(2, 1fr); }
    .section { padding: 56px 32px; }
    .personality-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .gen-section { padding: 56px 32px; }
    .site-footer{padding:24px 25px;}
    .hero_text {
        width: 55%;
    }
    .hero_rights {
        width: 20%;
        align-items: center;
    height: 100%;
    }
    .hero_right {
    width: 100%;
    align-items: center;
    display: flex;
    justify-content: center;
    }
    .hero p{
        line-height: 1.2;
    };
.hero_right img{
    width:auto;
}
    .hero_right:nth-child(2),
    .hero_right:nth-child(3) { display: none; }
}
@media (max-width: 600px) {
    .gen-band {
        border-top: 1px solid #DDD;
    }
    .site-header {
        padding:8px 0 0 0;
        overflow: hidden;
    }
    .section-title {
        font-size: 20px;
    }
    .items-grid {
        grid-template-columns: 1fr;
    }
    .header-red {
        padding: 8px 12px 8px 12px;
        gap: 8px;
    }
    .header-red h1 {
        font-size: 16px;
    }
    .header-red img {
        height: 28px;
        width: auto;
    }
    .footer-left span{
        width: 100%;
    }
    .items-grid .item-card:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        justify-self: center;
        width: calc(100% - 6px);
    }
    .hero{
        align-items: center;
    }
    .hero_left{
        width:40%;
    }
    .hero_text {
        width: 60%;
        padding: 25px 16px 25px 8px;
    }
    .hero_rights {
       display: none;;
    }
    .hero h2, .hero h1 { font-size: 28px; }
    .hero p { font-size: 12px; line-height: 1.6; max-width: 100%; }
    .btn-start { padding: 10px 24px; font-size: 14px; margin-top: 45px; }


    .steps-grid { grid-template-columns: repeat(2, 1fr); }

    .button-group { flex-direction: column;   }

    .gen-btn, .reset-btn { width: 100%; }
    #section01 { overflow: hidden; padding-left: 24px; padding-right: 0; position: relative; }
    #section01::before,
    #section01::after {
        content: "";
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        height: 300px;
        width: 30px;
        background: #fff;
        z-index: 2;
        pointer-events: none;
    }
    #section01::before { left: 0; }
    #section01::after { right: 0; }
    .step-title{ font-size: 18px;}

    /* ── Swipeable personality carousel ── */
    .personality-grid {
        display: flex;
        flex-direction: row;
        gap: 12px;
        width: 80vw;
        margin: 0 auto;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scroll-padding-left: 0;
        /* hide scrollbar */
        scrollbar-width: none;
        padding-right: 24px;
        margin-right: 40px;
    }
    .personality-grid::-webkit-scrollbar { display: none; }
    .p-card {
        width: 90%;
        max-width: 320px;
        min-width: min(200px, 60vw);
    }
    .p-carousel-nav {
        display: flex;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 25px;
        height: 300px;
        border: 0;
        border-radius: 12px;
        align-items: center;
        justify-content: center;
        background: #bdbdbd;
        color: white;
        font-size: 30px;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 8px 24px rgba(0,0,0,0.18);
        z-index: 3;
        -webkit-tap-highlight-color: rgba(80, 80, 88, 0.24);
    }
    .p-carousel-nav:hover,
    .p-carousel-nav:focus,
    .p-carousel-nav:active {
        background: #bdbdbd;
        outline: none;
    }
    .p-carousel-prev { left: 5px; }
    .p-carousel-next { right: 5px; }
    /* first card peek offset */
    .p-card:first-child { margin-left: 0; }
    .footer-left{
        flex-direction: column;
        text-align: center;
            width: 100%;
    }
    .site-footer{justify-content: center;}
}

@media (max-width: 376px) {
    .hero_left{
        width:66%;
    }
    .hero_text {
        width: 75%;
        padding: 25px;
    }
    .hero_rights {
        display: none;
    }
    .hero {
        align-items: center;
        padding: 20px 0 0 0;
    }
    .hero p {
        font-size: 12px;
        line-height: 1.2;
        max-width: 100%;
    }
    .section-title {
        font-size: 20px;
    }
    .hero_text{padding: 24px 15px 20px;}
    .hero_right {
       display: none;
    }
}
