/* Field collection */
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.25rem 0;
}

.source-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.source-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.source-card.collected {
    border-color: var(--success);
    background: rgba(105, 240, 174, 0.05);
    animation: collectedPulse 2.5s ease-in-out infinite;
}

.source-card.collecting {
    border-color: var(--accent);
    background: rgba(0, 212, 240, 0.06);
    animation: collectingPulse 1.2s ease-in-out infinite;
}

@keyframes collectingPulse {
    0%, 100% { box-shadow: 0 0 0 rgba(0, 212, 240, 0); }
    50% { box-shadow: 0 0 22px rgba(0, 212, 240, 0.25); }
}

@keyframes collectedPulse {
    0%, 100% { box-shadow: 0 0 0 rgba(105, 240, 174, 0); }
    50% { box-shadow: 0 0 18px rgba(105, 240, 174, 0.15); }
}

.source-card.collected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 12px;
    color: var(--success);
    font-size: 1.25rem;
    font-weight: 700;
}

.source-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 0.75rem;
    color: var(--accent);
    background: rgba(0, 212, 240, 0.08);
    border-radius: 50%;
    padding: 14px;
    border: 1px solid rgba(0, 212, 240, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

.source-card:hover .source-icon {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(0, 212, 240, 0.2);
}

.source-card.collected .source-icon {
    background: rgba(105, 240, 174, 0.1);
    border-color: rgba(105, 240, 174, 0.35);
    color: var(--success);
}

.source-card h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text);
}

.source-meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

.source-icon {
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
    vertical-align: -3px;
}

.source-status {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Quality panel */
.quality-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.quality-card:hover {
    border-color: var(--accent);
}

.quality-card h4 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.severity {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
}

.severity.critical { background: rgba(255, 82, 82, 0.15); color: var(--error); }
.severity.medium { background: rgba(255, 179, 0, 0.15); color: var(--warning); }
.severity.low { background: rgba(105, 240, 174, 0.15); color: var(--success); }

.option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    margin: 0.6rem 0;
    padding: 1rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}

.option::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 240, 0.08), transparent);
    transform: skewX(-20deg);
    transition: left 0s;
}

.option:hover {
    border-color: var(--accent);
    background: var(--panel-hover);
    transform: translateX(4px);
}

.option:hover::after {
    left: 150%;
    transition: left 0.7s ease;
}

.option-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.option-content {
    flex: 1;
}

.option-content strong {
    display: block;
    margin-bottom: 0.25rem;
}

.option-content small {
    display: block;
    color: var(--entropy);
    font-size: 0.8rem;
}

.option-content .entropy-prefers {
    display: inline-block;
    background: rgba(255, 152, 0, 0.15);
    color: var(--entropy);
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.reveal {
    background: rgba(105, 240, 174, 0.08);
    border-left: 4px solid var(--success);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Aggregation flow */
.aggregate-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.flow-source {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 1.5rem;
    transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
}

.flow-source.active {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 16px var(--border-glow);
}

.flow-arrow {
    color: var(--muted);
    font-size: 1.5rem;
}

.flow-core {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--panel);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 2rem;
    position: relative;
}

.flow-core.active::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px dashed var(--accent);
    animation: spin 8s linear infinite;
}

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

/* Charts */
.chart-container {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.chart-title {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.chart-line {
    filter: drop-shadow(0 0 4px var(--accent));
    animation: linePulse 2.2s ease-in-out infinite;
}

.chart-point {
    transform-origin: center;
    animation: pointPulse 2.2s ease-in-out infinite;
}

.chart-point:nth-child(odd) { animation-delay: 0.2s; }
.chart-point:nth-child(even) { animation-delay: 0.5s; }

@keyframes linePulse {
    0%, 100% { filter: drop-shadow(0 0 4px var(--accent)); }
    50% { filter: drop-shadow(0 0 10px var(--accent)); }
}

.skill-chart svg {
    display: block;
    max-width: 100%;
}

.skill-chart .chart-bar {
    transition: fill 0.2s, opacity 0.2s;
}

.skill-chart .chart-bar:hover {
    fill: var(--accent-hover);
    opacity: 0.9;
}

.skill-chart polyline,
.skill-chart circle[fill="var(--accent)"] {
    transition: stroke 0.2s, fill 0.2s;
}

.skill-chart path:hover {
    opacity: 0.85;
}

#csv-viewer .chart-container {
    background: var(--panel);
    margin-top: 1rem;
}

@keyframes pointPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.85; }
}

.chart-bar {
    transform-origin: bottom;
    transition: transform 0.2s, filter 0.2s;
}

.chart-bar:hover {
    transform: scaleY(1.04);
    filter: brightness(1.15);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    text-align: left;
    padding: 0.6rem;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
}

/* Report */
.report-option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.report-option::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 212, 240, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0s, height 0s;
}

.report-option:hover {
    border-color: var(--accent);
    transform: translateX(6px);
    box-shadow: var(--shadow);
}

.report-option:active::after {
    width: 300px;
    height: 300px;
    transition: width 0.5s ease, height 0.5s ease;
}

/* Entropy's one opinion on the report, before and after it is judged: its voice, not a verdict. */
.entropy-lean {
    margin: 0 0 1rem;
    color: var(--accent);
    font-style: italic;
}

/* Entropy's lean: marked, not endorsed. A dashed edge reads as a suggestion. */
.report-option.entropy-leaned {
    border-style: dashed;
    border-color: var(--accent);
}

.report-option .letter {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--panel);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.report-option .body {
    flex: 1;
}

.report-option .body strong {
    display: block;
    margin-bottom: 0.25rem;
}

.report-option .body small {
    color: var(--entropy);
    font-size: 0.8rem;
}

.score-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.score {
    text-align: center;
    padding: 1.25rem 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: border-color 0.3s, transform 0.3s;
}

.score.pop {
    border-color: var(--accent);
    transform: scale(1.05);
}

.score .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.score .label {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reaction-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideIn 0.4s ease both;
}

.reaction-card:nth-child(1) { animation-delay: 0.1s; }
.reaction-card:nth-child(2) { animation-delay: 0.2s; }
.reaction-card:nth-child(3) { animation-delay: 0.3s; }

.reaction-card.pleased {
    border-left: 4px solid var(--success);
}

.reaction-card.angry {
    border-left: 4px solid var(--error);
}

/* Confetti */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 200;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    top: -10px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}


.model-icon {
    margin: 0 auto 0.5rem;
}
