:root {
    /* Default Playful Pink */
    --primary: #FF90B3; 
    --bg-color: #FFFDF8;
    --text-color: #2D334A;
    --border-color: #2D334A;
    --card-bg: #FFFFFF;
    --shadow-color: #2D334A;
    --border-width: 3px;
}

/* MBTI Color Themes */
body.theme-nt {
    --primary: #C084FC; /* Analysts - Purple */
    --bg-color: #FAF5FF;
}
body.theme-nf {
    --primary: #4ADE80; /* Diplomats - Green */
    --bg-color: #F0FDF4;
}
body.theme-sj {
    --primary: #60A5FA; /* Sentinels - Blue */
    --bg-color: #EFF6FF;
}
body.theme-sp {
    --primary: #FBBF24; /* Explorers - Yellow */
    --bg-color: #FEFCE8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background-color: var(--bg-color);
    /* Playful polka dot background */
    background-image: radial-gradient(var(--border-color) 1.5px, transparent 1.5px);
    background-size: 24px 24px;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.5s ease;
}

/* Add a subtle noise texture to remove the "flat" vector AI feel */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
}

.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    max-height: 850px;
    background: var(--bg-color);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    border: var(--border-width) solid var(--border-color);
    box-shadow: 8px 8px 0 var(--shadow-color);
    display: flex;
    flex-direction: column;
    transition: background-color 0.5s ease;
}

@media (min-width: 481px) {
    .app-container {
        height: 90vh;
        border-radius: 32px;
        margin: 20px;
    }
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateY(10px);
    transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: var(--bg-color);
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    z-index: 10;
}

/* Playful Neo-brutalist Buttons */
.cute-btn {
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: 800;
    border: var(--border-width) solid var(--border-color);
    border-radius: 16px;
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 4px 4px 0 var(--shadow-color);
    position: relative;
    background: var(--card-bg);
    color: var(--text-color);
}

.cute-btn::after {
    content: '';
    position: absolute;
    top: 4px; left: 4px; right: 4px; bottom: 4px;
    border-radius: 10px;
    border: 2px dashed rgba(45, 51, 74, 0.1);
    pointer-events: none;
}

.cute-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--shadow-color);
}

.cute-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0 var(--shadow-color);
}

.cute-btn.primary {
    background: var(--primary);
}

.cute-btn.primary::after {
    border-color: rgba(255,255,255,0.4);
}

/* Typography & Layout */
h1 {
    font-family: 'Pangolin', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
    color: var(--text-color);
    text-shadow: 3px 3px 0 var(--primary);
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 48px;
    padding: 8px 16px;
    background: var(--card-bg);
    border: var(--border-width) solid var(--border-color);
    border-radius: 20px;
    display: inline-block;
    transform: rotate(-3deg);
    box-shadow: 4px 4px 0 var(--shadow-color);
}

.icon-bounce {
    font-size: 80px;
    margin-bottom: 24px;
    filter: drop-shadow(4px 4px 0 var(--shadow-color));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

/* Quiz Screen */
.progress-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.progress-bar-bg {
    flex: 1;
    height: 20px;
    background: var(--card-bg);
    border: var(--border-width) solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 3px 3px 0 rgba(0,0,0,0.06);
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-right: var(--border-width) solid var(--border-color);
}

.progress-text {
    font-family: 'Pangolin', sans-serif;
    font-weight: 800;
    font-size: 1.3rem;
    min-width: 65px;
    text-align: right;
}

.question-card {
    background: var(--primary);
    border: var(--border-width) solid var(--border-color);
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: 6px 6px 0 var(--shadow-color);
    margin-bottom: 32px;
    position: relative;
    transform: rotate(1deg);
    transition: background-color 0.5s ease;
}

.question-card::before {
    content: '';
    position: absolute;
    top: 8px; left: 8px; right: 8px; bottom: 8px;
    border: 3px dashed rgba(255,255,255,0.4);
    border-radius: 16px;
    pointer-events: none;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.5;
    color: var(--text-color);
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-btn {
    text-align: left;
    justify-content: flex-start;
    padding: 20px;
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.4;
    border-radius: 20px;
}

.option-letter {
    font-family: 'Pangolin', sans-serif;
    font-size: 1.3rem;
    background: var(--primary);
    border: var(--border-width) solid var(--border-color);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 2px 2px 0 var(--shadow-color);
    transition: background-color 0.5s ease;
}

/* Loading Screen */
.spinner {
    font-size: 80px;
    margin-bottom: 24px;
    display: inline-block;
    filter: drop-shadow(4px 4px 0 var(--shadow-color));
    animation: wiggle 0.8s infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(-12deg); }
    50% { transform: rotate(12deg); }
}

.loading-text {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 12px;
}

/* Result Screen */
.result-card {
    background: var(--card-bg);
    border: var(--border-width) solid var(--border-color);
    border-radius: 24px;
    padding: 36px 24px;
    box-shadow: 8px 8px 0 var(--shadow-color);
    margin-bottom: 24px;
    position: relative;
    flex: 1;
}

.result-card::after {
    content: '🐾';
    position: absolute;
    top: -24px;
    right: 20px;
    font-size: 40px;
    background: var(--primary);
    border: var(--border-width) solid var(--border-color);
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 0 var(--shadow-color);
    transform: rotate(15deg);
}

.result-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 3px dashed var(--border-color);
}

.mbti-type {
    font-family: 'Pangolin', sans-serif;
    font-size: 4.5rem;
    font-weight: 800;
    color: var(--text-color);
    text-shadow: 4px 4px 0 var(--primary);
    line-height: 1;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.mbti-title {
    font-size: 1.3rem;
    font-weight: 800;
    background: var(--primary);
    display: inline-block;
    padding: 8px 20px;
    border-radius: 24px;
    border: var(--border-width) solid var(--border-color);
}

.result-breed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--bg-color);
    padding: 16px;
    border-radius: 16px;
    border: var(--border-width) solid var(--border-color);
    margin-bottom: 24px;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: inset 3px 3px 0 rgba(0,0,0,0.04);
}

.result-section {
    margin-bottom: 24px;
}

.result-section h4 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-section h4::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border: var(--border-width) solid var(--border-color);
    border-radius: 50%;
}

.result-section p {
    font-size: 1.05rem;
    line-height: 1.6;
    font-weight: 500;
}

.result-section.highlight {
    background: var(--primary);
    padding: 20px;
    border-radius: 16px;
    border: var(--border-width) solid var(--border-color);
    transform: rotate(-1.5deg);
    box-shadow: 4px 4px 0 var(--shadow-color);
}

.result-section.highlight p {
    font-weight: 800;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 24px;
}
