/* ===========================
   ADAPTIVE TRYOUT — Neubrutalist CSS
   =========================== */

@import 'variables.css';

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--cream);
    color: var(--black);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* PAGE SYSTEM */
.page { display: none; min-height: 100vh; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

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

/* LOGO */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--black);
    margin-bottom: 24px;
}

.logo-img {
    height: 48px;
    width: auto;
    display: block;
    object-fit: contain;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.back-btn {
    position: fixed;
    top: 16px;
    left: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--black);
    background: var(--white);
    border: var(--border);
    border-radius: 9999px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
    z-index: 100;
}

.back-btn:hover {
    background: var(--lavender);
    box-shadow: var(--shadow-md);
}

.back-btn:active {
    transform: scale(0.97);
}

.logo:hover .logo-img {
    transform: scale(1.03);
}
.logo-icon {
    width: 40px; height: 40px;
    background: var(--yellow);
    border: var(--border);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 20px;
}
.logo-text { font-weight: 800; font-size: 20px; }

/* BUTTONS */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font); font-weight: 700; font-size: 15px;
    padding: 12px 24px; border: var(--border); border-radius: var(--radius);
    cursor: pointer; text-decoration: none; transition: transform 0.1s, box-shadow 0.1s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn-primary {
    background: var(--blue); color: var(--white); box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: #3451de; }
.btn-outline {
    background: var(--white); color: var(--black); box-shadow: var(--shadow-sm);
}
.btn-outline:hover { background: #f5f5f5; }
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===========================
   GENERATING PAGE
   =========================== */
.gen-container {
    max-width: 520px;
    margin: 0 auto;
    padding: 60px 20px;
    text-align: center;
}

.gen-card {
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 30px;
}

.gen-spinner {
    width: 48px; height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.gen-card h1 { font-size: 22px; font-weight: 800; margin-bottom: 12px; }
.gen-desc { font-size: 14px; color: #666; margin-bottom: 24px; line-height: 1.6; }

.gen-steps { text-align: left; }

.gen-step {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; font-size: 14px; color: #aaa;
    transition: color 0.3s;
}
.gen-step.active { color: var(--black); font-weight: 600; }

.gen-dot {
    width: 24px; height: 24px; min-width: 24px;
    border: 2px solid #ddd; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
}
.gen-step.active .gen-dot {
    border-color: var(--blue); background: var(--blue);
}
.gen-step.active .gen-dot::after {
    content: ''; width: 8px; height: 8px;
    background: var(--white); border-radius: 50%;
    animation: pulse 1s ease infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.gen-error {
    margin-top: 20px;
    padding: 16px;
    background: #fef2f2;
    border: 2px solid var(--red);
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
}

/* ===========================
   START PAGE
   =========================== */
.start-container {
    max-width: 560px;
    margin: 0 auto;
    padding: 60px 20px;
    text-align: center;
}

.start-card {
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 30px;
}

.start-badge {
    display: inline-block;
    background: var(--lavender);
    border: 2px solid var(--black);
    border-radius: 20px;
    padding: 4px 16px;
    font-weight: 700; font-size: 13px;
    margin-bottom: 16px;
}

.start-card h1 { font-size: 24px; font-weight: 900; margin-bottom: 12px; }
.start-desc { font-size: 14px; color: #555; line-height: 1.6; margin-bottom: 24px; }

.start-stats {
    display: flex; gap: 16px; justify-content: center; margin-bottom: 24px;
}
.start-stat {
    background: var(--cream);
    border: var(--border);
    border-radius: 10px;
    padding: 16px 28px;
    box-shadow: var(--shadow-sm);
}
.start-stat-value { font-size: 28px; font-weight: 900; color: var(--blue); }
.start-stat-label { font-size: 12px; font-weight: 600; color: #666; margin-top: 2px; }

.subtest-overview {
    text-align: left;
    margin-bottom: 24px;
    border: var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.subtest-overview-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-bottom: 2px solid #eee;
    font-size: 13px;
}
.subtest-overview-item:last-child { border-bottom: none; }
.subtest-overview-code {
    background: var(--sky);
    border: 2px solid var(--black);
    border-radius: 6px;
    padding: 2px 8px;
    font-weight: 800; font-size: 11px;
    min-width: 38px; text-align: center;
}
.subtest-overview-name { flex: 1; font-weight: 600; }
.subtest-overview-count { font-weight: 700; color: var(--blue); }

/* ===========================
   QUESTION PAGE
   =========================== */
.question-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.question-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.question-meta {
    display: flex; align-items: center; gap: 10px;
}
.subtest-badge {
    background: var(--sky);
    border: 2px solid var(--black);
    border-radius: 6px;
    padding: 3px 10px;
    font-weight: 800; font-size: 13px;
}
.question-counter { font-weight: 700; font-size: 14px; color: #555; }
.q-progress-text { font-size: 13px; font-weight: 600; color: #888; }

.q-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
}
.q-progress-fill {
    height: 100%; background: var(--blue);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.difficulty-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px; font-weight: 700;
    margin-bottom: 16px;
}
.diff-easy { background: #dcfce7; color: #166534; }
.diff-medium { background: #fef3c7; color: #92400e; }
.diff-hard { background: #fce7f3; color: #9d174d; }

.question-text {
    font-size: 16px; font-weight: 600;
    line-height: 1.7;
    margin-bottom: 24px;
    white-space: pre-wrap;
}

.options-grid { display: flex; flex-direction: column; gap: 10px; }

.option-btn {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px;
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-align: left;
    font-family: var(--font);
    font-size: 14px;
    transition: transform 0.1s, box-shadow 0.1s, border-color 0.1s;
}
.option-btn:hover { border-color: var(--brand); }
.option-btn:active { transform: translate(3px, 3px); box-shadow: none; }
.option-btn.selected {
    border-color: var(--brand);
    background: var(--brand-softer);
    box-shadow: 3px 3px 0px var(--brand);
}

.option-label {
    background: var(--cream);
    border: 2px solid var(--black);
    border-radius: 8px;
    width: 32px; height: 32px; min-width: 32px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px;
}
.option-btn.selected .option-label {
    background: var(--brand); color: var(--white); border-color: var(--brand);
}

.option-text { padding-top: 5px; line-height: 1.5; }

.question-nav {
    display: flex; justify-content: space-between; gap: 12px;
    margin-top: 24px;
}

.question-dots {
    display: flex; flex-wrap: wrap; gap: 6px;
    justify-content: center;
    margin-top: 20px;
}
.dot {
    width: 10px; height: 10px;
    background: #d1d5db;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}
.dot.answered { background: var(--blue); }
.dot.current { background: var(--yellow); border: 2px solid var(--black); width: 14px; height: 14px; }

/* ===========================
   RESULT PAGE
   =========================== */
.result-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

.result-header {
    margin-bottom: 32px;
}
.result-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 20px 0;
}
.result-header .logo { margin-bottom: 0; }
.btn-dashboard {
    padding: 8px 20px;
    font-size: 14px;
    background: var(--yellow);
    box-shadow: var(--shadow-sm);
}
.result-header h1 { font-size: 28px; font-weight: 900; text-align: center; margin-top: 32px; }

.result-overall-card {
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    text-align: center;
    margin-bottom: 32px;
}
.result-overall-card.result-green { border-color: #16a34a; box-shadow: 5px 5px 0 #16a34a; }
.result-overall-card.result-blue { border-color: var(--blue); box-shadow: 5px 5px 0 var(--blue); }
.result-overall-card.result-orange { border-color: var(--orange); box-shadow: 5px 5px 0 var(--orange); }
.result-overall-card.result-red { border-color: var(--red); box-shadow: 5px 5px 0 var(--red); }

.result-level { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 8px; }
.result-score-big { font-size: 64px; font-weight: 900; }
.result-green .result-score-big { color: #16a34a; }
.result-blue .result-score-big { color: var(--blue); }
.result-orange .result-score-big { color: var(--orange); }
.result-red .result-score-big { color: var(--red); }
.result-detail { font-size: 15px; color: #666; font-weight: 600; margin-top: 4px; }

.result-section { margin-bottom: 32px; }
.result-section h2 { font-size: 18px; font-weight: 800; margin-bottom: 16px; }
.section-desc { font-size: 14px; color: #666; margin-bottom: 16px; }

/* Subtest cards */
.result-subtest-card {
    background: var(--white);
    border: var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
}
.result-st-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.result-st-code {
    background: var(--sky);
    border: 2px solid var(--black);
    border-radius: 6px;
    padding: 2px 8px;
    font-weight: 800; font-size: 11px;
}
.result-st-name { flex: 1; font-weight: 600; font-size: 14px; }
.result-st-pct { font-weight: 800; font-size: 16px; }
.result-st-green { color: #16a34a; }
.result-st-blue { color: var(--blue); }
.result-st-orange { color: var(--orange); }

.result-st-bar {
    height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-bottom: 4px;
}
.result-st-bar-fill {
    height: 100%; border-radius: 4px; transition: width 0.5s ease;
}
.fill-green { background: #16a34a; }
.fill-blue { background: var(--blue); }
.fill-orange { background: var(--orange); }
.fill-purple { background: var(--purple); }
.fill-red { background: var(--red); }

.result-st-detail { font-size: 12px; color: #888; font-weight: 600; }

/* Comparison */
.comp-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--white);
    border: var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    box-shadow: var(--shadow-sm);
}
.comp-code {
    background: var(--sky);
    border: 2px solid var(--black);
    border-radius: 6px;
    padding: 2px 6px;
    font-weight: 800; font-size: 11px;
    min-width: 36px; text-align: center;
}
.comp-name { flex: 1; font-weight: 600; font-size: 12px; }
.comp-original, .comp-adaptive { font-weight: 700; min-width: 36px; text-align: center; }
.comp-arrow { font-weight: 900; font-size: 16px; }
.comp-change { font-weight: 700; min-width: 45px; text-align: right; }
.comp-up { color: #16a34a; }
.comp-down { color: var(--red); }
.comp-same { color: #888; }

/* Review cards */
.review-card {
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.review-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.review-badge {
    background: var(--sky);
    border: 2px solid var(--black);
    border-radius: 6px;
    padding: 2px 8px;
    font-weight: 800; font-size: 11px;
}
.review-diff {
    padding: 2px 10px; border-radius: 6px; font-size: 11px; font-weight: 700;
}
.review-question {
    font-size: 14px; font-weight: 600; line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.review-options { margin-bottom: 12px; }
.review-opt {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 4px;
}
.review-opt-label { font-weight: 800; min-width: 20px; }
.review-correct { background: #dcfce7; color: #166534; font-weight: 600; }
.review-wrong { background: #fef2f2; color: #991b1b; font-weight: 600; text-decoration: line-through; }

.review-your-answer { font-size: 13px; color: #666; margin-bottom: 4px; }
.review-correct-answer { font-size: 13px; color: #166534; margin-bottom: 8px; }
.review-explanation {
    font-size: 13px; line-height: 1.6;
    background: #f0f9ff;
    border: 2px solid var(--sky);
    border-radius: 8px;
    padding: 12px;
    color: #1e40af;
}

.review-perfect {
    text-align: center;
    padding: 40px;
    font-size: 18px; font-weight: 700;
    color: #16a34a;
}

.result-cta { text-align: center; margin-top: 32px; }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 600px) {
    .gen-container, .start-container { padding: 30px 16px; }
    .gen-card, .start-card { padding: 28px 20px; }
    .start-card h1 { font-size: 20px; }
    .start-stats { flex-direction: column; gap: 10px; }
    .question-container { padding: 16px; }
    .question-text { font-size: 15px; }
    .result-container { padding: 24px 16px; }
    .result-score-big { font-size: 48px; }
    .comp-row { flex-wrap: wrap; }
    .comp-name { width: 100%; }
    .share-buttons { grid-template-columns: repeat(2, 1fr); }
}

/* ===========================
   SHARE BUTTONS
   =========================== */
.share-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.btn-share {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    border-radius: 12px;
    border: 3px solid #1a1a1a;
    background: #fff;
    box-shadow: 4px 4px 0 #1a1a1a;
    cursor: pointer;
    transition: all 0.1s;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #333;
}

.btn-share:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #1a1a1a;
}

.btn-share:active {
    transform: translate(4px, 4px);
    box-shadow: 0 0 0 #1a1a1a;
}

.btn-share-wa { color: #25D366; }
.btn-share-tw { color: #1a1a1a; }
.btn-share-ig { color: #E4405F; }
.btn-share-copy { color: #4361ee; }
