:root {
    --bg-deep: #090d16;
    --card-bg: rgba(15, 23, 42, 0.24);
    --border-glass: rgba(129, 140, 248, 0.18);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --success: #10b981;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

#matrix-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    display: block;
}

.ambient-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(15, 23, 42, 0) 70%);
    z-index: -2;
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 780px;
    text-align: center;
}

.brain-icon {
    width: 92px;
    height: auto;
    display: block;
    margin: 0 auto 14px auto;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.45));
    animation: brainPulse 3.2s ease-in-out infinite;
}

@keyframes brainPulse {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.35)); }
    50% { filter: drop-shadow(0 0 18px rgba(129, 140, 248, 0.7)); }
}

.brain-nodes circle {
    animation: nodeBlink 2.4s ease-in-out infinite;
}
.brain-nodes circle:nth-child(2n) { animation-delay: 0.6s; }
.brain-nodes circle:nth-child(3n) { animation-delay: 1.1s; }

@keyframes nodeBlink {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}

.badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.3rem;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, #fff 30%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 340px;
    margin: 0 auto 20px auto;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.field-label {
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.participant-summary {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: -4px 0 18px;
    padding: 11px 14px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.45);
    text-align: left;
}

.participant-summary strong {
    color: #f8fafc;
    font-size: 0.95rem;
}

.participant-summary span {
    color: #94a3b8;
    font-size: 0.8rem;
}

.report-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 16px;
}

.report-brand-mark {
    width: 58px;
    height: 50px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
}

.report-brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.report-brand-copy {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 2px;
}

.report-brand-copy strong {
    color: #f8fafc;
    font-size: 1rem;
}

.report-brand-copy span {
    color: #94a3b8;
    font-size: 0.76rem;
}

.participant-result {
    margin: -2px 0 18px;
    color: #94a3b8;
    font-size: 0.86rem;
}

.participant-result strong {
    color: #e2e8f0;
}

.input-field, select.input-field {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-glass);
    padding: 12px 16px;
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.input-field:focus {
    border-color: var(--accent);
}

.modes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    text-align: left;
}

.mode-card {
    background: rgba(15, 23, 42, 0.5);
    border: 2px solid var(--border-glass);
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-card:hover, .mode-card.selected {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.mode-card h4 {
    margin: 0 0 4px 0;
    font-size: 0.9rem;
    color: #818cf8;
}

.mode-card p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    border: none;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    transition: transform 0.1s;
}

.btn-primary:hover {
    transform: translateY(-1px);
}

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 3px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.4s ease;
}

.timer-badge {
    background: rgba(15, 23, 42, 0.6);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    font-variant-numeric: tabular-nums;
}

.matrix-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: rgba(15, 23, 42, 0.6);
    padding: 16px;
    border-radius: 14px;
    margin: 0 auto 20px auto;
    max-width: 320px;
    border: 1px solid var(--border-glass);
}

.matrix-cell {
    background: rgba(30, 41, 59, 0.5);
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.option-card {
    background: rgba(30, 41, 59, 0.5);
    border: 2px solid var(--border-glass);
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90px;
    transition: all 0.2s ease;
}

.option-card:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.option-card.text-option {
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
    text-align: left;
    padding: 14px 16px;
    min-height: 0;
    justify-content: flex-start;
}

.options-grid.text-grid {
    grid-template-columns: 1fr;
    gap: 10px;
}

.logic-prompt {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 6px;
    font-size: 1.05rem;
    line-height: 1.55;
    color: #f1f5f9;
    text-align: left;
}

.memory-screen {
    text-align: center;
    padding: 6px 0 10px 0;
}

.memory-value {
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid var(--accent);
    border-radius: 16px;
    padding: 24px 20px;
    margin: 14px auto 18px auto;
    max-width: 320px;
    text-shadow: 0 0 20px rgba(129, 140, 248, 0.6);
}

.memory-value.is-name {
    font-size: 2rem;
    letter-spacing: 1px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin: 20px 0;
    text-align: left;
}

.stat-card {
    background: rgba(15, 23, 42, 0.6);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
}

.stat-card h4 {
    margin: 0 0 6px 0;
    font-size: 0.8rem;
    color: #818cf8;
    text-transform: uppercase;
}

.stat-card p {
    margin: 0;
    font-size: 1.25rem;
    font-weight: bold;
    color: #fff;
}

.chart-container {
    position: relative;
    margin: 15px auto;
    height: 220px;
    width: 100%;
    max-width: 420px;
}