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

body {
    font-family: system-ui, sans-serif;
    background: #1a1a1a;
    color: #f0f0f0;
    padding: 2rem;
    max-width: 700px;
    margin: 0 auto;
}

h1 {
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 4px;
}

p.sub {
    font-size: 14px;
    color: #999;
    margin-bottom: 1.5rem;
}

.card {
    border: 1px solid #333;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.record-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid #444;
    background: #2a2a2a;
    color: #f0f0f0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    background: #333;
}

button:focus-visible {
    outline: 2px solid #85B7EB;
    outline-offset: 3px;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#recordButton.recording {
    border-color: #A32D2D;
    color: #f28b8b;
    background: #501313;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f28b8b;
    display: none;
    flex-shrink: 0;
}

.recording .dot {
    display: block;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

#timer {
    font-size: 13px;
    color: #999;
    font-family: monospace;
}

/* Visually hidden but accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.field-label {
    display: block;
    font-size: 13px;
    color: #999;
    margin-bottom: 4px;
}

textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    font-size: 14px;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 8px;
    background: #2a2a2a;
    color: #f0f0f0;
    font-family: inherit;
    line-height: 1.6;
}

textarea:focus {
    outline: 2px solid #85B7EB;
    outline-offset: 1px;
    border-color: #85B7EB;
}

.button-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.clear-button {
    font-size: 12px;
    padding: 6px 12px;
}

.error {
    font-size: 14px;
    color: #f28b8b;
    padding: 0.5rem 0;
    min-height: 1.5em;
}

/* ------------------------------------------------------------------ */
/* Results list                                                        */
/* ------------------------------------------------------------------ */

.messages-label {
    font-size: 12px;
    font-weight: 500;
    color: #999;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.message {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}

.message:focus-within {
    border-color: #444;
}

.message.expanded {
    border-color: #85B7EB;
    background: #1e2a38;
}

/* ---- Number badge ---- */

.message-number {
    font-size: 12px;
    font-weight: 500;
    color: #85B7EB;
    background: #042C53;
    border-radius: 6px;
    padding: 2px 8px;
    min-width: 28px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 3px;
}

.message-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

/* h3 reset — looks like body text, navigable as heading */
.message-text {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    color: #f0f0f0;
    margin: 0;
}

/* ---- Open-to-reply button ---- */

.open-reply-button {
    align-self: flex-start;
    font-size: 12px;
    padding: 5px 12px;
    color: #85B7EB;
    border-color: #185FA5;
    background: transparent;
}

.open-reply-button:hover {
    background: #0d3a60;
}

/* ---- Reply panel ---- */

.message-reply {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Override display:flex when hidden attribute is present */
.message-reply[hidden] {
    display: none;
}

.message-reply textarea {
    min-height: 70px;
    font-size: 13px;
}

.reply-button-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.voice-reply-button {
    font-size: 12px;
    padding: 6px 12px;
}

.voice-reply-button.recording {
    border-color: #A32D2D;
    color: #f28b8b;
    background: #501313;
}

/* ---- Close reply button ---- */

.close-reply-button {
    align-self: flex-start;
    font-size: 12px;
    padding: 5px 12px;
    color: #999;
    border-color: #444;
    background: transparent;
    margin-top: 2px;
}

.close-reply-button:hover {
    background: #333;
    color: #f0f0f0;
}

/* ------------------------------------------------------------------ */
/* Action row ( send)                                           */
/* ------------------------------------------------------------------ */

.action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #333;
}

.send-button {
    font-size: 13px;
    padding: 8px 18px;
    background: #0d3a60;
    border-color: #185FA5;
    color: #85B7EB;
    margin-left: auto;
}

.send-button:hover {
    background: #185FA5;
    color: #f0f0f0;
}

.shortcut-hint {
    font-size: 11px;
    color: #557aaa;
    background: #042C53;
    border-radius: 4px;
    padding: 1px 5px;
}

.send-feedback {
    font-size: 13px;
    color: #5DCAA5;
}