:root {
    --bg-0: #07071a;
    --bg-1: #0d0d2b;
    --bg-2: #16163f;
    --glass: rgba(255, 255, 255, 0.06);
    --glass-strong: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.12);
    --text-0: #f5f3ff;
    --text-1: #c9c5e8;
    --text-2: #8f8bb3;
    --gold: #f0c987;
    --gold-deep: #d49a4a;
    --violet: #9b87f5;
    --pink: #f58ab5;
    --danger: #ff7a8a;

    --wood: #4fd1a5;
    --fire: #ff6b6b;
    --earth: #f4c95d;
    --metal: #dfe4ee;
    --water: #5aa9ff;

    --radius-sm: 12px;
    --radius: 20px;
    --radius-lg: 28px;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    --glow-gold: 0 0 30px rgba(240, 201, 135, 0.35);
    --ease: cubic-bezier(.22, 1, .36, 1);

    --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
    --font-serif: 'Noto Serif KR', serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    color: var(--text-0);
    background: radial-gradient(1200px 800px at 80% -10%, #2a1d5c 0%, transparent 60%),
                radial-gradient(900px 700px at -10% 110%, #3a1640 0%, transparent 60%),
                linear-gradient(180deg, var(--bg-0), var(--bg-1));
    background-attachment: fixed;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.stars, .stars::before, .stars::after {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.stars {
    background-image:
        radial-gradient(1px 1px at 10% 20%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 30% 70%, #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 55% 30%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 75% 85%, #fff 50%, transparent 51%),
        radial-gradient(1.2px 1.2px at 90% 15%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 45% 55%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 20% 90%, #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 65% 60%, #fff 50%, transparent 51%);
    background-size: 600px 600px;
    opacity: .5;
    animation: twinkle 6s ease-in-out infinite alternate;
}
.stars::before {
    content: "";
    background-image:
        radial-gradient(1px 1px at 15% 40%, #ffe9c4 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 85% 50%, #d9d2ff 50%, transparent 51%),
        radial-gradient(1px 1px at 50% 10%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 35% 85%, #fff 50%, transparent 51%);
    background-size: 420px 420px;
    animation: twinkle 4s ease-in-out infinite alternate-reverse;
}
@keyframes twinkle { from { opacity: .25; } to { opacity: .8; } }

.page {
    position: relative;
    z-index: 1;
    max-width: 560px;
    margin: 0 auto;
    padding: 20px 20px 60px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0 18px;
}
.logo {
    font-family: var(--font-serif);
    font-weight: 700;
    letter-spacing: .04em;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.logo-mark {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: conic-gradient(var(--wood), var(--fire), var(--earth), var(--metal), var(--water), var(--wood));
    color: var(--bg-0);
    font-size: .8rem;
    box-shadow: 0 0 18px rgba(155, 135, 245, .5);
}
.logo-mark::after {
    content: "緣";
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--bg-1);
    color: var(--gold);
    display: grid; place-items: center;
}
.nav-pill {
    font-size: .82rem;
    font-weight: 600;
    color: var(--gold);
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(240, 201, 135, .1);
    border: 1px solid rgba(240, 201, 135, .3);
    transition: background .2s;
}
.nav-pill:hover { background: rgba(240, 201, 135, .2); }

.dex-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.dex-item {
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    border-radius: var(--radius);
    background: radial-gradient(circle at 80% 0%, color-mix(in srgb, var(--accent) 30%, #14113a), rgba(14, 12, 42, .85) 75%);
    border: 1px solid var(--glass-border);
    transition: transform .25s var(--ease), border-color .25s;
}
.dex-item:hover { transform: translateY(-3px); border-color: rgba(240, 201, 135, .45); }
.dex-item[hidden] { display: none; }
.dex-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .75rem;
    margin-bottom: 8px;
}
.dex-num { color: var(--gold); font-weight: 700; }
.dex-mbti {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    font-weight: 700;
}
.dex-item-hanja {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 6px;
}
.dex-item-title {
    font-size: .88rem;
    font-weight: 700;
    line-height: 1.4;
    word-break: keep-all;
    margin-bottom: 6px;
}
.dex-item-meta { font-size: .75rem; color: var(--text-2); margin-top: auto; }
.dex-hero-card {
    text-align: center;
    background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 40%, #14113a), #0e0c2a 75%);
    border-color: rgba(240, 201, 135, .35);
}

.footer {
    margin-top: auto;
    padding-top: 40px;
    text-align: center;
    color: var(--text-2);
    font-size: .8rem;
}
.footer a { text-decoration: underline; text-underline-offset: 3px; }

.eyebrow {
    display: inline-block;
    font-size: .78rem;
    letter-spacing: .2em;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 10px;
}
.h1 {
    font-family: var(--font-serif);
    font-size: clamp(1.9rem, 7vw, 2.6rem);
    line-height: 1.3;
    margin: 0 0 14px;
    font-weight: 700;
}
.h1-single {
    font-size: clamp(1.35rem, 5.2vw, 2.05rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.h2 {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    margin: 0 0 12px;
}
.h3 { font-size: 1.05rem; margin: 0 0 8px; color: var(--gold); }
.lead { color: var(--text-1); font-size: 1.02rem; margin: 0 0 24px; }
.muted { color: var(--text-2); font-size: .88rem; }
.gradient-text {
    background: linear-gradient(120deg, var(--gold), var(--pink) 55%, var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 17px 24px;
    border: 0;
    border-radius: 999px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), opacity .2s;
    overflow: hidden;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary {
    color: #2a1a05;
    background: linear-gradient(120deg, #ffe3ad, var(--gold) 40%, var(--gold-deep));
    box-shadow: var(--glow-gold);
}
.btn-primary:not([disabled]):hover { transform: translateY(-2px); box-shadow: 0 0 45px rgba(240, 201, 135, .55); }
.btn-primary::after {
    content: "";
    position: absolute;
    top: 0; left: -60%;
    width: 40%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .6), transparent);
    transform: skewX(-20deg);
    animation: shine 3.2s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.btn-ghost {
    color: var(--text-0);
    background: var(--glass);
    border: 1px solid var(--glass-border);
}
.btn-ghost:hover { background: var(--glass-strong); }
.btn-kakao {
    color: #191919;
    background: #FEE500;
    box-shadow: 0 0 24px rgba(254, 229, 0, .25);
}
.btn-kakao:hover { transform: translateY(-2px); box-shadow: 0 0 36px rgba(254, 229, 0, .45); }
.btn-row { display: flex; gap: 10px; }

.hero {
    text-align: center;
    padding-top: 8px;
}
.hero-visual {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 0 0 28px;
    aspect-ratio: 16 / 11;
    box-shadow: var(--shadow), 0 0 80px rgba(155, 135, 245, .25);
    animation: float 7s ease-in-out infinite;
}
.hero-visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-visual::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(7, 7, 26, .85));
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.feature-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 28px 0;
}
.feature {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px 8px;
    font-size: .82rem;
    color: var(--text-1);
    transition: transform .3s var(--ease), border-color .3s;
}
.feature:hover { transform: translateY(-4px); border-color: rgba(240, 201, 135, .4); }
.feature b {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 4px;
}

.element-orbit {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 6px 0 26px;
}
.el-chip {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.1rem;
    border: 1px solid currentColor;
    background: color-mix(in srgb, currentColor 14%, transparent);
    box-shadow: 0 0 18px color-mix(in srgb, currentColor 40%, transparent);
    animation: bob 3s ease-in-out infinite;
}
.el-chip:nth-child(2) { animation-delay: .2s; }
.el-chip:nth-child(3) { animation-delay: .4s; }
.el-chip:nth-child(4) { animation-delay: .6s; }
.el-chip:nth-child(5) { animation-delay: .8s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.wood  { color: var(--wood); }
.fire  { color: var(--fire); }
.earth { color: var(--earth); }
.metal { color: var(--metal); }
.water { color: var(--water); }
.unknown { color: var(--text-2); }

.form-group { margin-bottom: 22px; }
.label {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 8px;
}
.input, .select {
    width: 100%;
    padding: 15px 16px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-0);
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
    appearance: none;
    -webkit-appearance: none;
}
.select {
    background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 34px;
}
.select option { background: var(--bg-2); color: var(--text-0); }
.input:focus, .select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(240, 201, 135, .15);
    background: rgba(255, 255, 255, .08);
}
.input:disabled, .select:disabled { opacity: .4; }
.row { display: grid; gap: 8px; }
.row-3 { grid-template-columns: 1.3fr 1fr 1fr; }
.row-2 { grid-template-columns: 1fr 1fr; }

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 4px;
    position: relative;
}
.segmented input { display: none; }
.segmented label {
    text-align: center;
    padding: 11px 0;
    border-radius: 999px;
    cursor: pointer;
    color: var(--text-2);
    font-weight: 600;
    transition: color .25s, background .25s;
}
.segmented input:checked + label {
    color: #2a1a05;
    background: linear-gradient(120deg, #ffe3ad, var(--gold));
    box-shadow: var(--glow-gold);
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: .92rem;
    color: var(--text-1);
    user-select: none;
}
.check input {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 22px;
    width: 22px; height: 22px;
    margin: 1px 0 0;
    border-radius: 7px;
    border: 1.5px solid var(--text-2);
    display: grid; place-items: center;
    cursor: pointer;
    transition: all .2s;
}
.check input:checked {
    background: var(--gold);
    border-color: var(--gold);
}
.check input:checked::after {
    content: "✓";
    color: #2a1a05;
    font-weight: 900;
    font-size: .85rem;
}
.check input:disabled { opacity: .35; }

.consent-box {
    font-size: .82rem;
    color: var(--text-2);
    background: rgba(0, 0, 0, .2);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin: 10px 0 0;
    line-height: 1.7;
}
.consent-box b { color: var(--text-1); }

.error-msg {
    color: var(--danger);
    font-size: .88rem;
    min-height: 1.3em;
    margin: 8px 0 0;
}

.progress-wrap { margin-bottom: 26px; }
.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: .85rem;
    color: var(--text-2);
    margin-bottom: 8px;
}
.progress-meta b { color: var(--gold); }
.progress {
    height: 8px;
    background: rgba(255, 255, 255, .08);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--violet), var(--pink), var(--gold));
    box-shadow: 0 0 16px rgba(245, 138, 181, .6);
    transition: width .5s var(--ease);
}

.q-stage { position: relative; min-height: 300px; }
.q-card {
    display: none;
}
.q-card.active {
    display: block;
    animation: qFadeIn .22s var(--ease) both;
}
@keyframes qFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}
.q-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin: 22px 0 10px;
}
.q-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    transition: transform .25s var(--ease), background .25s;
}
.q-dot.is-done { background: rgba(155, 135, 245, .75); }
.q-dot.is-current { background: var(--gold); transform: scale(1.35); }
.q-hint {
    text-align: center;
    font-size: .82rem;
    color: var(--text-2);
    margin: 0 0 12px;
    word-break: keep-all;
}
.q-num {
    font-family: var(--font-serif);
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 14px;
}
.q-text {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.5;
    margin: 0 0 28px;
    word-break: keep-all;
}
.option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 20px 22px;
    margin-bottom: 12px;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-0);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    cursor: pointer;
    word-break: keep-all;
    transition: transform .25s var(--ease), border-color .25s, background .25s, box-shadow .25s;
}
.option:hover {
    transform: translateY(-2px);
    border-color: rgba(240, 201, 135, .5);
    background: var(--glass-strong);
}
.option.selected {
    border-color: var(--gold);
    background: rgba(240, 201, 135, .14);
    box-shadow: var(--glow-gold);
}
.option-tag {
    display: inline-block;
    font-weight: 800;
    color: var(--gold);
    margin-right: 8px;
}
.back-link {
    background: none;
    border: 0;
    color: var(--text-2);
    cursor: pointer;
    padding: 8px 0;
    font-size: .9rem;
}
.back-link:hover { color: var(--text-0); }
.back-link[hidden] { display: none; }

.loading {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 34px;
    background: rgba(7, 7, 26, .92);
    backdrop-filter: blur(10px);
    text-align: center;
    padding: 20px;
}
.loading.show { display: flex; animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.orbit {
    position: relative;
    width: 200px; height: 200px;
    animation: spin 8s linear infinite;
}
.orbit .el-chip {
    position: absolute;
    top: 50%; left: 50%;
    margin: -22px;
    animation: none;
}
.orbit .el-chip:nth-child(1) { transform: rotate(0deg)   translateY(-90px) rotate(0deg); }
.orbit .el-chip:nth-child(2) { transform: rotate(72deg)  translateY(-90px) rotate(-72deg); }
.orbit .el-chip:nth-child(3) { transform: rotate(144deg) translateY(-90px) rotate(-144deg); }
.orbit .el-chip:nth-child(4) { transform: rotate(216deg) translateY(-90px) rotate(-216deg); }
.orbit .el-chip:nth-child(5) { transform: rotate(288deg) translateY(-90px) rotate(-288deg); }
.orbit-core {
    position: absolute;
    top: 50%; left: 50%;
    width: 70px; height: 70px;
    margin: -35px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff7e0, var(--gold) 45%, transparent 70%);
    box-shadow: 0 0 60px var(--gold);
    animation: pulse 1.6s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(.85); opacity: .8; } 50% { transform: scale(1.1); opacity: 1; } }
.loading-text {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    min-height: 1.6em;
    transition: opacity .3s;
}

.reveal {
    perspective: 1200px;
    margin-bottom: 18px;
}
.reveal-inner {
    position: relative;
    min-height: 420px;
    transform-style: preserve-3d;
    transition: transform 1.1s var(--ease);
}
.reveal.flipped .reveal-inner { transform: rotateY(180deg); }
.reveal-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 24px;
    border: 1px solid rgba(240, 201, 135, .35);
    overflow: hidden;
}
.reveal-front {
    background: radial-gradient(circle at 50% 30%, #3b2a76, #120f33 70%);
    cursor: pointer;
}
.reveal-front .seal {
    width: 120px; height: 120px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-family: var(--font-serif);
    font-size: 3rem;
    color: var(--gold);
    border: 2px solid var(--gold);
    box-shadow: var(--glow-gold), inset 0 0 30px rgba(240, 201, 135, .3);
    margin-bottom: 22px;
    animation: pulse 2.2s ease-in-out infinite;
}
.reveal-back {
    transform: rotateY(180deg);
    background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 35%, #14113a), #0e0c2a 75%);
}
.big-hanja {
    font-family: var(--font-serif);
    font-size: 5.5rem;
    line-height: 1;
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 40px var(--accent);
    margin-bottom: 12px;
}
.partner-type {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 6px;
    word-break: keep-all;
}
.mbti-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: .12em;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .25);
    margin: 10px 0 4px;
}

.score-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
}
.score-ring {
    --p: 0;
    flex: 0 0 110px;
    width: 110px; height: 110px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: conic-gradient(var(--pink) calc(var(--p) * 1%), rgba(255, 255, 255, .08) 0);
    position: relative;
}
.score-ring::before {
    content: "";
    position: absolute;
    inset: 9px;
    border-radius: 50%;
    background: var(--bg-1);
}
.score-ring span {
    position: relative;
    font-family: var(--font-serif);
    font-size: 1.9rem;
    font-weight: 900;
}
.score-ring small { font-size: .9rem; }

.pillars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    text-align: center;
}
.pillar-label { font-size: .78rem; color: var(--text-2); margin-bottom: 6px; }
.pillar-char {
    border-radius: var(--radius-sm);
    padding: 10px 0 6px;
    margin-bottom: 6px;
    background: color-mix(in srgb, currentColor 12%, transparent);
    border: 1px solid color-mix(in srgb, currentColor 40%, transparent);
}
.pillar-char b {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.7rem;
    line-height: 1.2;
}
.pillar-char small { font-size: .72rem; opacity: .8; }

.el-bars { display: grid; gap: 10px; }
.el-bar {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 10px;
    font-size: .88rem;
}
.el-bar-name { font-family: var(--font-serif); font-weight: 700; }
.el-bar-track {
    height: 12px;
    background: rgba(255, 255, 255, .07);
    border-radius: 999px;
    overflow: hidden;
}
.el-bar-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: currentColor;
    box-shadow: 0 0 12px currentColor;
    transition: width 1.2s var(--ease);
}
.el-bar.is-partner .el-bar-name::after {
    content: " ★";
    color: var(--gold);
}

.dex-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--gold);
    background: rgba(0, 0, 0, .32);
    border: 1px solid rgba(240, 201, 135, .35);
    margin-bottom: 14px;
}
.hashtag-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}
.hashtag {
    font-size: .82rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
}

.chem-bars { display: grid; gap: 10px; }
.chem-bar {
    display: grid;
    grid-template-columns: 74px 1fr 40px;
    align-items: center;
    gap: 10px;
    font-size: .85rem;
}
.chem-label { color: var(--text-1); font-weight: 600; }
.chem-track {
    height: 10px;
    background: rgba(255, 255, 255, .07);
    border-radius: 999px;
    overflow: hidden;
}
.chem-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--violet), var(--pink), var(--gold));
    transition: width 1.1s var(--ease);
}
.chem-val { text-align: right; color: var(--gold); font-weight: 700; }

.tip-box {
    background: rgba(240, 201, 135, .08);
    border: 1px solid rgba(240, 201, 135, .28);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.tip-box .k { font-size: .8rem; font-weight: 700; color: var(--gold); }

.life-timeline { display: grid; gap: 14px; }
.life-more { display: grid; gap: 14px; }
.life-more[hidden] { display: none; }
.life-stage {
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-sm);
    padding: 16px;
}
.life-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}
.life-title { font-weight: 700; font-size: 1rem; color: var(--text-0); }
.life-age { font-size: .78rem; color: var(--gold); font-weight: 600; }
.life-basis { font-size: .78rem; color: var(--text-2); margin-bottom: 8px; }
.life-summary {
    font-family: var(--font-serif);
    font-size: .96rem;
    font-weight: 700;
    color: var(--gold);
    margin: 0 0 8px;
    word-break: keep-all;
}
.btn-expand {
    margin-top: 14px;
    padding: 13px 18px;
    font-size: .92rem;
    color: var(--gold);
    background: rgba(240, 201, 135, .1);
    border: 1px solid rgba(240, 201, 135, .35);
}
.btn-expand:hover { background: rgba(240, 201, 135, .18); }

.self-card {
    margin-bottom: 16px;
    background: radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent) 26%, #14113a), rgba(14, 12, 42, .85) 75%);
    border-color: rgba(255, 255, 255, .18);
}
.clash-card {
    background: radial-gradient(circle at 100% 0%, rgba(255, 107, 107, .16), rgba(14, 12, 42, .88) 70%);
    border-color: rgba(255, 122, 138, .32);
}
.role-badge {
    display: inline-block;
    font-size: .78rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 12px;
}
.role-me {
    color: #dbeafe;
    background: rgba(90, 169, 255, .2);
    border: 1px solid rgba(90, 169, 255, .4);
}
.role-partner {
    color: #ffe4ef;
    background: rgba(245, 138, 181, .22);
    border: 1px solid rgba(245, 138, 181, .45);
}
.role-clash {
    color: #fecdd3;
    background: rgba(255, 107, 107, .2);
    border: 1px solid rgba(255, 122, 138, .45);
}
.profile-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.profile-info { min-width: 0; flex: 1; }
.profile-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    color: var(--text-1);
    margin-bottom: 4px;
}
.profile-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 6px;
    word-break: keep-all;
}
.profile-link {
    font-size: .8rem;
    color: var(--gold);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.mbti-mini {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 800;
    background: rgba(255, 255, 255, .14);
    color: var(--text-0);
}
.clash-pill {
    background: rgba(255, 107, 107, .22);
    color: #fecdd3;
}
.mascot-avatar {
    flex: 0 0 auto;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}
.mascot-lg {
    width: 84px;
    height: 84px;
    margin: 4px auto;
    display: block;
}

.quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}
.quick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    padding: 16px 12px;
    border-radius: var(--radius);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    transition: transform .25s var(--ease), border-color .25s, background .25s;
}
.quick-card:hover {
    transform: translateY(-3px);
    border-color: rgba(240, 201, 135, .45);
    background: var(--glass-strong);
}
.quick-emoji { font-size: 1.5rem; line-height: 1.1; }
.quick-card b { font-size: .95rem; color: var(--text-0); }
.quick-card small { font-size: .76rem; color: var(--text-2); }

.rarity-badge {
    display: inline-block;
    font-size: .76rem;
    font-weight: 600;
    color: var(--gold);
    background: rgba(240, 201, 135, .12);
    border: 1px solid rgba(240, 201, 135, .3);
    border-radius: 999px;
    padding: 3px 10px;
    margin-bottom: 6px;
}

.vs-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}
.vs-person {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.vs-heart { font-size: 2rem; }

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.info-item {
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.info-item.full { grid-column: 1 / -1; }
.info-item .k { font-size: .78rem; color: var(--text-2); display: block; margin-bottom: 4px; }
.info-item .v { font-weight: 600; word-break: keep-all; }

.text-block { color: var(--text-1); margin: 0 0 12px; word-break: keep-all; }
.divider { height: 1px; background: var(--glass-border); margin: 18px 0; border: 0; }

.fade-up { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.fade-up.visible { opacity: 1; transform: none; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translate(-50%, 20px);
    background: rgba(20, 18, 50, .95);
    border: 1px solid var(--glass-border);
    padding: 12px 22px;
    border-radius: 999px;
    font-size: .92rem;
    opacity: 0;
    pointer-events: none;
    transition: all .35s var(--ease);
    z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.prose h2 { font-size: 1.05rem; color: var(--gold); margin: 22px 0 8px; }
.prose p, .prose li { color: var(--text-1); font-size: .92rem; }
.prose table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.prose th, .prose td { border: 1px solid var(--glass-border); padding: 8px; text-align: left; color: var(--text-1); }

.celeb-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}
.celeb-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--glass-border);
    transition: transform .25s var(--ease), border-color .25s;
}
.celeb-card:hover {
    transform: translateY(-2px);
    border-color: rgba(240, 201, 135, .4);
}
.celeb-match-badge {
    font-size: .75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    margin-bottom: 10px;
    color: var(--text-1);
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    white-space: nowrap;
}
.celeb-match-badge.is-exact {
    color: var(--gold);
    background: rgba(240, 201, 135, .15);
    border-color: rgba(240, 201, 135, .42);
}
.celeb-name {
    font-family: var(--font-serif);
    font-size: 1.06rem;
    font-weight: 700;
    margin: 2px 0 3px;
    color: var(--text-0);
    word-break: keep-all;
}
.celeb-role {
    font-size: .8rem;
    color: var(--gold);
    margin: 0 0 10px;
    word-break: keep-all;
}
.celeb-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 10px;
}
.celeb-cat {
    font-size: .75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(155, 135, 245, .2);
    color: #ddd6fe;
}
.celeb-stem {
    font-size: .75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(240, 201, 135, .14);
    color: var(--gold);
}
.celeb-mbti {
    font-size: .75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: var(--text-0);
}
.celeb-desc {
    font-size: .8rem;
    line-height: 1.5;
    color: var(--text-2);
    margin: 0;
    word-break: keep-all;
}
.celeb-note {
    font-size: .76rem;
    color: var(--text-2);
    margin: 12px 0 0;
    text-align: center;
    line-height: 1.55;
    word-break: keep-all;
}

.dex-unique-insight {
    margin: 14px 0 0;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(240, 201, 135, .1);
    border: 1px solid rgba(240, 201, 135, .3);
    font-size: .88rem;
    line-height: 1.55;
    color: var(--text-0);
    word-break: keep-all;
}

.jump-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0 18px;
    justify-content: center;
}
.jump-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-1);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    transition: border-color .2s, background .2s;
}
.jump-chip:hover {
    border-color: rgba(240, 201, 135, .45);
    background: var(--glass-strong);
}

.share-hint {
    font-size: .78rem;
    color: var(--text-2);
    text-align: center;
    margin: 4px 0 0;
}

.btn-top {
    position: fixed;
    right: 18px;
    bottom: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(240, 201, 135, .45);
    background: rgba(20, 18, 50, .92);
    color: var(--gold);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
    z-index: 50;
}
.btn-top:hover { background: rgba(34, 30, 82, .98); }

.nav-pill, .back-link, .profile-link, .footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 8px;
    margin: 4px 0;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.gate-hero {
    padding: 24px 20px;
    margin-bottom: 18px;
    background: radial-gradient(circle at 10% 0%, rgba(155, 135, 245, .28), rgba(14, 12, 42, .9) 72%);
    border-color: rgba(240, 201, 135, .36);
}
.gate-hero-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.gate-hero-img {
    width: 78px;
    height: 78px;
    border-radius: 16px;
    object-fit: cover;
    flex: 0 0 auto;
    border: 1px solid rgba(240, 201, 135, .35);
}
.gate-section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 22px 0 10px;
}
.gate-section-head h2 {
    font-family: var(--font-serif);
    font-size: 1.08rem;
    margin: 0;
    color: var(--text-0);
}
.gate-section-head span {
    font-size: .78rem;
    color: var(--gold);
}
.mini-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.mini-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 14px;
    border-radius: var(--radius);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    transition: transform .25s var(--ease), border-color .25s, background .25s;
}
.mini-card:hover {
    transform: translateY(-3px);
    border-color: rgba(240, 201, 135, .5);
    background: var(--glass-strong);
}
.mini-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}
.mini-emoji { font-size: 1.65rem; line-height: 1; }
.mini-tag {
    font-size: .75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(155, 135, 245, .2);
    color: #ddd6fe;
}
.mini-card-title {
    font-family: var(--font-serif);
    font-size: .96rem;
    font-weight: 700;
    color: var(--text-0);
    margin: 2px 0 0;
    line-height: 1.38;
    word-break: keep-all;
}
.mini-card-sub {
    font-size: .78rem;
    color: var(--text-2);
    margin: 0;
    line-height: 1.45;
    word-break: keep-all;
}
.mini-card-cta {
    margin-top: auto;
    padding-top: 6px;
    font-size: .8rem;
    font-weight: 700;
    color: var(--gold);
}
.soon-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.soon-pill {
    font-size: .76rem;
    color: var(--text-2);
    background: rgba(255, 255, 255, .04);
    border: 1px dashed rgba(255, 255, 255, .16);
    border-radius: 999px;
    padding: 5px 11px;
}
.stat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}
.match-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}
.match-box {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--glass-border);
    text-align: center;
}
.match-box small { display: block; font-size: .75rem; color: var(--text-2); margin-bottom: 4px; }
.match-box b { font-size: .88rem; color: var(--text-0); word-break: keep-all; }

@media (max-width: 380px) {
    .card { padding: 20px; }
    .q-text { font-size: 1.15rem; }
    .big-hanja { font-size: 4.5rem; }
    .celeb-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
