:root{
    --d-color:#FF6B6B;
    --i-color:#FFB347;
    --s-color:#4ECDC4;
    --c-color:#5C7AEA;
    --ink:#2b2b3a;
    --muted:#8a8a9a;
    --bg-grad: radial-gradient(circle at 15% 0%, #FFD66B 0%, transparent 45%),
               radial-gradient(circle at 100% 10%, #8E7CFF 0%, transparent 40%),
               linear-gradient(160deg,#7B6CF6 0%,#A06CF6 35%,#FF6FA0 75%,#FFA45C 100%);
    --card-radius:28px;
    --shadow-soft:0 14px 40px rgba(45,20,90,.18);
    --shadow-pop:0 10px 24px rgba(255,107,107,.35);
}
*{box-sizing:border-box;}
html,body{margin:0;}
body{
    font-family:'Kanit','Trebuchet MS',sans-serif;
    background: var(--bg-grad);
    background-attachment:fixed;
    min-height:100vh;
    color:var(--ink);
    position:relative;
    overflow-x:hidden;
}
body::before, body::after{
    content:'';
    position:fixed;
    border-radius:50%;
    filter:blur(2px);
    opacity:.5;
    z-index:0;
    pointer-events:none;
}
body::before{
    width:220px;height:220px;
    background:rgba(255,255,255,.18);
    top:-60px; right:-60px;
}
body::after{
    width:160px;height:160px;
    background:rgba(255,255,255,.14);
    bottom:6%; left:-50px;
}

.wrap{
    max-width:640px;
    margin:0 auto;
    padding:28px 18px 70px;
    position:relative;
    z-index:1;
}
.brand{
    text-align:center;
    font-size:2.4rem;
    font-weight:800;
    color:#fff;
    letter-spacing:.5px;
    text-shadow:0 4px 14px rgba(0,0,0,.18);
    margin-bottom:4px;
}
.brand span{
    background:linear-gradient(90deg,#FFF06B,#FFD66B);
    -webkit-background-clip:text;
    background-clip:text;
    -webkit-text-fill-color:transparent;
}
.tagline{
    text-align:center;
    color:rgba(255,255,255,.92);
    margin-bottom:26px;
    font-size:1rem;
    font-weight:500;
}

/* Card */
.card{
    background:#fff;
    border-radius:var(--card-radius);
    box-shadow:var(--shadow-soft);
    padding:30px 26px;
    position:relative;
    animation:cardIn .45s ease both;
}
@keyframes cardIn{
    from{opacity:0; transform:translateY(14px) scale(.99);}
    to{opacity:1; transform:translateY(0) scale(1);}
}

/* Hero (landing) */
.hero-emoji{
    font-size:3.2rem;
    text-align:center;
    margin-bottom:6px;
}
.hero-text{
    font-size:1.05rem;
    line-height:1.7;
    text-align:center;
    color:var(--ink);
}
.house-pill-row{
    display:flex;
    justify-content:center;
    gap:8px;
    flex-wrap:wrap;
    margin:18px 0 22px;
}
.house-pill{
    padding:8px 14px;
    border-radius:50px;
    font-weight:700;
    font-size:.85rem;
    color:#fff;
}
.hero-note{
    text-align:center;
    color:var(--muted);
    font-size:.88rem;
    margin-bottom:22px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:6px;
}

/* Buttons */
.btn{
    display:inline-block;
    border:none;
    cursor:pointer;
    padding:16px 30px;
    border-radius:50px;
    font-size:1.05rem;
    font-weight:700;
    font-family:inherit;
    background:linear-gradient(135deg,#FF6B6B,#FF9966);
    color:#fff;
    box-shadow:var(--shadow-pop);
    transition:transform .15s ease, box-shadow .15s ease;
}
.btn:hover{transform:translateY(-3px); box-shadow:0 14px 28px rgba(255,107,107,.45);}
.btn:active{transform:translateY(0);}
.btn:disabled{opacity:.5;cursor:not-allowed;transform:none;box-shadow:none;}
.btn-block{width:100%;text-align:center;}
.btn-ghost{
    background:#F3F0FF;
    color:#6C4FE0;
    box-shadow:none;
}

/* Forms */
.form-group{margin-bottom:18px;}
label{display:block;font-weight:700;margin-bottom:7px;font-size:.9rem;color:var(--ink);}
input[type=text],input[type=tel],input[type=email],input[type=password],select{
    width:100%;
    padding:14px 16px;
    border-radius:16px;
    border:2px solid #EDEAF7;
    background:#FAF9FF;
    font-size:1rem;
    font-family:inherit;
    transition:border-color .15s ease, background .15s ease;
}
input:focus,select:focus{outline:none;border-color:#A06CF6;background:#fff;}
.pdpa{
    display:flex;
    align-items:flex-start;
    gap:10px;
    background:linear-gradient(135deg,#FFF3DC,#FFE8E8);
    border-radius:16px;
    padding:16px;
    font-size:.85rem;
    margin-bottom:22px;
    line-height:1.6;
    color:#6b5a3d;
}
.pdpa input{margin-top:3px; accent-color:#FF6B6B; width:18px; height:18px;}
.error{
    color:#c0274a;
    background:#FFE7EC;
    border-radius:12px;
    padding:10px 14px;
    font-size:.85rem;
    font-weight:600;
}

/* Quiz */
.quiz-top{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:14px;
    color:#fff;
    font-weight:700;
}
.quiz-top span{
    background:rgba(255,255,255,.18);
    padding:6px 16px;
    border-radius:50px;
    font-size:.92rem;
    backdrop-filter:blur(4px);
}
.progress-bar{
    height:10px;
    background:rgba(255,255,255,.3);
    border-radius:10px;
    overflow:hidden;
    margin-bottom:20px;
}
.progress-fill{
    height:100%;
    background:linear-gradient(90deg,#FFF06B,#FFB347);
    border-radius:10px;
    transition:width .35s ease;
}
.timer-circle{
    width:56px;height:56px;border-radius:50%;
    display:flex;align-items:center;justify-content:center;
    background:#fff;color:#FF6B6B;font-weight:800;font-size:1.25rem;
    box-shadow:0 8px 18px rgba(0,0,0,.18);
    border:4px solid #FFD66B;
    transition:border-color .2s ease, color .2s ease;
}
.timer-circle.warn{border-color:#e0445b;color:#e0445b; animation:pulse .6s infinite;}
@keyframes pulse{0%,100%{transform:scale(1);}50%{transform:scale(1.08);}}
.question-text{
    font-size:1.3rem;
    font-weight:700;
    margin-bottom:24px;
    line-height:1.45;
}
.options{display:flex;flex-direction:column;gap:12px;}
.option-btn{
    text-align:left;
    padding:17px 18px;
    border-radius:18px;
    border:2px solid #EDEAF7;
    background:#FAF9FF;
    font-size:1rem;
    font-family:inherit;
    cursor:pointer;
    transition:all .15s ease;
    display:flex;
    align-items:center;
    gap:10px;
}
.option-btn::before{
    content:'';
    width:10px;height:10px;border-radius:50%;
    border:2px solid #D8D2EF;
    flex:0 0 auto;
    transition:all .15s ease;
}
.option-btn:hover{border-color:#C9B8FF;background:#F4F0FF;}
.option-btn.selected{
    border-color:var(--d-color);
    background:#FFEDED;
    transform:scale(1.015);
    box-shadow:0 6px 16px rgba(255,107,107,.18);
}
.option-btn.selected::before{
    border-color:var(--d-color);
    background:var(--d-color);
}

/* Result */
.house-badge{
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:8px 20px;
    border-radius:50px;
    color:#fff;
    font-weight:700;
    margin-bottom:14px;
    box-shadow:0 8px 18px rgba(0,0,0,.15);
}
.result-title{font-size:1.7rem;font-weight:800;margin:0 0 6px;}
.result-sub{color:var(--muted);margin-bottom:20px;font-size:.95rem;}
.chart-frame{
    background:#FAF9FF;
    border-radius:20px;
    padding:14px 6px 4px;
    margin-bottom:6px;
}
.section-title{
    font-weight:800;
    font-size:1.08rem;
    margin:26px 0 12px;
    display:flex;align-items:center;gap:8px;
    padding-bottom:8px;
    border-bottom:2px dashed #EDEAF7;
}
ul.tidy{padding-left:0;margin:0;list-style:none;}
ul.tidy li{
    margin-bottom:9px;
    line-height:1.55;
    padding-left:28px;
    position:relative;
    font-size:.96rem;
}
ul.tidy li::before{
    content:'✓';
    position:absolute;
    left:0;
    top:0;
    width:20px;height:20px;
    border-radius:50%;
    background:#E9F8F6;
    color:#1AA39A;
    font-size:.72rem;
    font-weight:800;
    display:flex;align-items:center;justify-content:center;
}
.cautions li::before{
    content:'!';
    background:#FFF1E0;
    color:#E08B2B;
}
.chip-row{display:flex;flex-wrap:wrap;gap:9px;}
.chip{
    background:#F1F3FF;
    color:#3949AB;
    padding:8px 16px;
    border-radius:50px;
    font-size:.86rem;
    font-weight:600;
    border:1px solid #E2E6FF;
}
canvas#radarChart{max-width:100%;}
.share-row{display:flex;gap:10px;margin-top:26px;}

/* Admin */
.admin-body{background:#F2F3FB;font-family:'Kanit',sans-serif;}
.admin-wrap{max-width:1140px;margin:0 auto;padding:28px 20px 60px;}
.admin-nav{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:22px;
    flex-wrap:wrap;
    gap:12px;
}
.admin-nav h2{margin:0;font-weight:800;color:var(--ink);}
.admin-nav a{color:#6C4FE0;font-weight:600;text-decoration:none;}
.admin-nav a:hover{text-decoration:underline;}
.stat-row{display:flex;gap:16px;flex-wrap:wrap;margin-bottom:20px;}
.stat-card{
    flex:1;
    min-width:160px;
    background:#fff;
    border-radius:18px;
    padding:18px 20px;
    box-shadow:0 6px 18px rgba(20,20,50,.06);
}
.stat-card .num{font-size:1.8rem;font-weight:800;color:#6C4FE0;}
.stat-card .lbl{font-size:.84rem;color:var(--muted);font-weight:600;}
.admin-card{
    background:#fff;
    border-radius:20px;
    padding:22px;
    box-shadow:0 6px 18px rgba(20,20,50,.06);
    margin-bottom:20px;
}
table.admin-table{width:100%;border-collapse:separate;border-spacing:0;}
table.admin-table th{
    background:#F6F4FF;
    color:#5A4BB0;
    text-align:left;
    padding:13px 14px;
    font-size:.82rem;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.3px;
}
table.admin-table th:first-child{border-radius:12px 0 0 12px;}
table.admin-table th:last-child{border-radius:0 12px 12px 0;}
table.admin-table td{
    padding:14px;
    font-size:.92rem;
    border-bottom:1px solid #F0EFF7;
}
table.admin-table tbody tr{transition:background .12s ease;}
table.admin-table tbody tr:hover{background:#FAF9FF;}
table.admin-table a{color:#6C4FE0;font-weight:700;text-decoration:none;}
table.admin-table a:hover{text-decoration:underline;}
.tag-house{padding:5px 12px;border-radius:30px;color:#fff;font-size:.78rem;font-weight:700;display:inline-block;}
.status-pill{padding:4px 10px;border-radius:30px;font-size:.78rem;font-weight:700;}
.status-done{background:#E5F8F3;color:#1AA39A;}
.status-pending{background:#FFF2DE;color:#E08B2B;}
.admin-login-wrap{max-width:380px;padding-top:90px;}
.admin-brand{text-align:center;font-size:1.9rem;font-weight:800;color:var(--ink);margin-bottom:24px;}

@media (max-width:560px){
    .card{padding:22px 18px;}
    .brand{font-size:2rem;}
    table.admin-table{font-size:.85rem;}
}
