/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #fff;
    --bg-alt: #fafaf8;
    --surface: #fff;
    --border: #ebebeb;
    --text: #1a1a1a;
    --text-2: #555;
    --text-3: #999;
    --accent: #1a1a1a;
    --accent-soft: #f5f5f3;
    --purple: #7c6cf0;
    --purple-soft: rgba(124, 108, 240, 0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --r: 12px;
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

html { font-size: 16px; }

body {
    font-family: -apple-system, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Noto Sans CJK SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ===== Layout ===== */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 24px 60px;
}

.page-narrow {
    max-width: 520px;
    width: 100%;
}

/* ===== Home ===== */
.home { justify-content: center; gap: 48px; }

.home-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.home-art {
    width: 200px;
    height: 200px;
    margin-bottom: 8px;
}

.home-art svg {
    width: 100%;
    height: 100%;
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.home-sub {
    font-size: 1rem;
    color: var(--text-2);
    font-weight: 400;
}

.home-desc {
    font-size: 0.88rem;
    color: var(--text-3);
    line-height: 1.8;
    max-width: 380px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    font-family: inherit;
    pointer-events: auto;
    user-select: none;
    position: relative;
    z-index: 1;
}

.btn-dark {
    background: var(--text);
    color: #fff;
}

.btn-dark:hover {
    background: #333;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--text);
}

.btn svg { flex-shrink: 0; }

/* ===== Features ===== */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    width: 100%;
}

.feature {
    background: var(--surface);
    padding: 28px 20px;
    text-align: center;
}

.feature-num {
    font-size: 0.7rem;
    color: var(--text-3);
    letter-spacing: 0.1em;
    margin-bottom: 10px;
    font-weight: 600;
}

.feature h3 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.feature p {
    font-size: 0.78rem;
    color: var(--text-3);
    line-height: 1.6;
}

.home-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.home-footer-line {
    width: 40px;
    height: 1px;
    background: var(--border);
}

.home-footer-items {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
    color: var(--text-3);
    letter-spacing: 0.02em;
}

.home-footer-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.home-footer-item svg {
    opacity: 0.4;
}

.home-footer-dot {
    opacity: 0.3;
}

.home-footer-copy {
    font-size: 0.68rem;
    color: var(--text-3);
    opacity: 0.4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ===== Quiz ===== */
.quiz-page {
    background: var(--bg-alt);
    padding: 60px 24px;
}

.quiz-wrap {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Progress */
.progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-track {
    flex: 1;
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--text);
    border-radius: 1px;
    transition: width 0.4s var(--ease);
}

.progress-label {
    font-size: 0.75rem;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    min-width: 40px;
    text-align: right;
}

/* Question */
.q-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 32px 28px;
    animation: qIn 0.3s var(--ease);
}

@keyframes qIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.q-num {
    font-size: 0.7rem;
    color: var(--text-3);
    letter-spacing: 0.12em;
    font-weight: 600;
    margin-bottom: 16px;
}

.q-text {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.7;
}

/* Done / Submit */
.q-done-icon {
    margin-bottom: 16px;
    animation: donePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.q-done-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 8px;
    animation: fadeUp 0.4s var(--ease) both;
    animation-delay: 0.15s;
}

.q-done-desc {
    font-size: 0.85rem;
    color: var(--text-3);
    animation: fadeUp 0.4s var(--ease) both;
    animation-delay: 0.25s;
}

@keyframes donePop {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

/* Options */
.opts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.opt {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    font-family: inherit;
    color: var(--text);
    text-align: left;
    width: 100%;
}

.opt:hover {
    border-color: var(--text);
    background: var(--accent-soft);
}

.opt:active { transform: scale(0.995); }

.opt-key {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--accent-soft);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-3);
    flex-shrink: 0;
    margin-top: 1px;
}

.opt.selected {
    border-color: var(--text);
    background: var(--accent-soft);
}

.opt.faded {
    opacity: 0.3;
    pointer-events: none;
}

/* ===== Result ===== */
.result-page {
    background: var(--bg-alt);
    padding: 60px 24px 80px;
}

.result-wrap {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* Result art */
.result-art {
    width: 220px;
    height: 220px;
    animation: artIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: 0.2s;
}

.result-art svg {
    width: 100%;
    height: 100%;
}

@keyframes artIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

/* Result text */
.result-text {
    text-align: center;
    animation: fadeUp 0.5s var(--ease) both;
    animation-delay: 0.35s;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.result-poem {
    font-size: 0.9rem;
    color: var(--text-2);
    line-height: 1.9;
    max-width: 420px;
}

/* Radar */
.radar-box {
    width: 100%;
    max-width: 340px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    animation: fadeUp 0.5s var(--ease) both;
    animation-delay: 0.5s;
}

.radar-box canvas {
    width: 100%;
    height: auto;
}

/* Dims */
.dims {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}

.dim {
    background: var(--surface);
    padding: 20px;
    animation: fadeUp 0.4s var(--ease) both;
}

.dim:nth-child(1) { animation-delay: 0.6s; }
.dim:nth-child(2) { animation-delay: 0.68s; }
.dim:nth-child(3) { animation-delay: 0.76s; }
.dim:nth-child(4) { animation-delay: 0.84s; }
.dim:nth-child(5) { animation-delay: 0.92s; }
.dim:nth-child(6) { animation-delay: 1.0s; }

.dim-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.dim-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.dim-pct {
    font-size: 0.8rem;
    color: var(--purple);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.dim-bar {
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    margin-bottom: 12px;
    overflow: hidden;
}

.dim-bar-fill {
    height: 100%;
    background: var(--text);
    border-radius: 1px;
    transition: width 0.8s var(--ease);
}

.dim-desc {
    font-size: 0.82rem;
    color: var(--text-2);
    line-height: 1.75;
}

/* Actions */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    animation: fadeUp 0.4s var(--ease) both;
    animation-delay: 1.1s;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 80px 0;
}

.loading-dots {
    display: flex;
    gap: 6px;
}

.ldot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-3);
    animation: pulse 1.2s ease-in-out infinite;
}

.ldot:nth-child(2) { animation-delay: 0.15s; }
.ldot:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

.loading-txt {
    font-size: 0.82rem;
    color: var(--text-3);
}

/* Hidden canvas */
#shareCanvas { display: none; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .page { padding: 48px 20px 40px; }
    h1 { font-size: 1.8rem; }
    .home-art { width: 160px; height: 160px; }
    .features { grid-template-columns: 1fr; }
    .feature { padding: 20px; text-align: left; display: flex; gap: 14px; align-items: flex-start; }
    .feature-num { margin-bottom: 0; margin-top: 2px; }
    .q-card { padding: 24px 20px; }
    .q-text { font-size: 0.95rem; }
    .result-art { width: 180px; height: 180px; }
    .result-title { font-size: 1.3rem; }
}
