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

:root {
    --color-primary: #4f46e5;
    --color-primary-dark: #4338ca;
    --color-bg: #fafafa;
    --color-surface: #fff;
    --color-text: #1a1a1a;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-success: #059669;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ====== Typography ====== */
h1 { font-size: 1.75rem; margin-bottom: 1rem; }
h2 { font-size: 1.25rem; margin-bottom: 0.75rem; color: var(--color-text); }
p { margin-bottom: 0.75rem; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
blockquote {
    border-left: 3px solid var(--color-primary);
    padding: 0.75rem 1rem;
    background: #f8f7ff;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}

/* ====== Layout ====== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
}

/* ====== Nav ====== */
.top-nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--color-primary);
}
.logo:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-links a { font-size: 0.9rem; margin-right: 1em; font-weight: bold; }

/* ====== Buttons ====== */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    font-size: 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.85rem; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1.1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ====== Cards ====== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

/* ====== Hero ====== */
.hero {
    text-align: center;
    padding: 1.5rem 0 2rem;
}
.hero h1 { font-size: 2rem; }
.hero-sub {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}
.hero-steps {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}
.step {
    flex: 0 1 180px;
    text-align: center;
}
.step-num {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.step p { font-size: 0.9rem; color: var(--color-text-muted); }

/* ====== Recorder ====== */
.recorder-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}
.recorder-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.timer {
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 1.5rem;
    color: var(--color-text);
}
.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
}
.indicator.recording {
    background: var(--color-danger);
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ====== Forms ====== */
textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    resize: vertical;
    font-family: inherit;
}
textarea:focus {
    border-color: var(--color-primary);
    outline: none;
}
.char-count {
    text-align: right;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ====== Radio cards ====== */
.radio-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.radio-card {
    flex: 1;
    min-width: 140px;
    padding: 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s;
}
.radio-card:hover { border-color: var(--color-primary); }
.radio-card input { display: none; }
.radio-card input:checked + .radio-label { color: var(--color-primary); font-weight: 600; }
.radio-card:has(input:checked) {
    border-color: var(--color-primary);
    background: #f8f7ff;
}

/* ====== Tables ====== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th, .data-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.data-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ====== Detail grid ====== */
.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    font-size: 0.9rem;
}
.detail-grid dt { font-weight: 600; color: var(--color-text-muted); }

/* ====== Status badges ====== */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #e5e7eb;
    color: #374151;
}
.status-published, .status-collecting, .status-active { background: #dbeafe; color: #1d4ed8; }
.status-completed, .status-emailed, .status-accepted { background: #d1fae5; color: #065f46; }
.status-failed, .status-rejected { background: #fee2e2; color: #991b1b; }
.status-refunded, .status-voided { background: #fef3c7; color: #92400e; }
.status-scoring, .status-submitted { background: #ede9fe; color: #5b21b6; }

/* ====== Score display ====== */
.score-hero { text-align: center; }
.score-display {
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-primary);
}
.score-unit { font-size: 1.25rem; color: var(--color-text-muted); }
.score-explanation { color: var(--color-text-muted); margin-top: 0.5rem; }
.score-inline { font-weight: 600; }
.score-high { color: var(--color-success); }
.score-mid { color: var(--color-warning); }
.score-low { color: var(--color-danger); }

/* ====== Misc ====== */
.error-text { color: var(--color-danger); }
.status-msg { margin-top: 1rem; padding: 0.5rem; border-radius: var(--radius); }
.info-section { max-width: 600px; margin: 2rem auto; }
.filter-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--color-border);
}

/* ====== Responsive ====== */
@media (max-width: 600px) {
    .hero h1 { font-size: 1.5rem; }
    .hero-steps { flex-direction: column; align-items: center; }
    .step { flex-basis: 60px; }
    .radio-group { flex-direction: column; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.4rem 0.5rem; }
}
