/* Rank Brain Recorder v1.0.0 */
.rbr-root {
    --rbr-primary: #9E3F1F;
    --rbr-primary-dark: #7A2E13;
    --rbr-card-bg: #ffffff;
    --rbr-surface: #F5F5F3;
    --rbr-text: #1F1F1F;
    --rbr-muted: #6B6B6B;
    --rbr-border: rgba(0,0,0,0.1);
    --rbr-danger: #B3261E;
    --rbr-success-bg: #E8F5E9;
    --rbr-success-border: #A5D6A7;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--rbr-surface);
    border: 1px solid var(--rbr-border);
    border-radius: 12px;
    padding: 18px 20px 14px;
    margin: 20px 0;
    line-height: 1.5;
}
.rbr-root *, .rbr-root *::before, .rbr-root *::after { box-sizing: border-box; }

.rbr-header { margin-bottom: 14px; }
.rbr-heading {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--rbr-text);
}
.rbr-subtext { font-size: 13px; color: var(--rbr-muted); margin: 0; }

/* Choose state */
.rbr-state[data-state="choose"] {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.rbr-state[data-state="choose"][hidden] { display: none; }

.rbr-record-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--rbr-card-bg);
    color: var(--rbr-primary);
    border: 1.5px solid var(--rbr-primary);
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease;
}
.rbr-record-btn:hover { background: var(--rbr-primary); color: #ffffff; }
.rbr-record-btn:focus-visible { outline: 3px solid rgba(158,63,31,0.25); outline-offset: 2px; }

/* Recording state */
.rbr-state[data-state="recording"] {
    text-align: center;
    padding: 8px 0 4px;
}
.rbr-recording-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--rbr-card-bg);
    border: 1px solid var(--rbr-border);
    border-radius: 999px;
    padding: 8px 18px;
    margin-bottom: 14px;
}
.rbr-red-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #E53935;
    border-radius: 50%;
    animation: rbr-pulse 1s ease-in-out infinite;
}
@keyframes rbr-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}
.rbr-timer {
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    font-weight: 600;
    color: var(--rbr-text);
}
.rbr-mode-label {
    font-size: 13px;
    color: var(--rbr-muted);
}
.rbr-stop-btn {
    display: block;
    margin: 0 auto;
    background: #E53935;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}
.rbr-stop-btn:hover { background: #C62828; }
.rbr-max-notice { font-size: 12px; color: var(--rbr-muted); margin: 10px 0 0; }

/* Preview state */
.rbr-preview-container {
    margin-bottom: 12px;
    background: var(--rbr-card-bg);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--rbr-border);
    text-align: center;
}
.rbr-preview-container audio { width: 100%; }
.rbr-preview-container video { max-width: 100%; display: block; margin: 0 auto; }

.rbr-preview-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.rbr-attach-btn {
    flex: 1;
    min-width: 120px;
    background: var(--rbr-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}
.rbr-attach-btn:hover { background: var(--rbr-primary-dark); }

.rbr-redo-btn {
    background: transparent;
    color: var(--rbr-muted);
    border: 1px solid var(--rbr-border);
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}
.rbr-redo-btn:hover { background: var(--rbr-card-bg); color: var(--rbr-text); }

/* Uploading */
.rbr-state[data-state="uploading"] {
    text-align: center;
    padding: 24px 0 10px;
    color: var(--rbr-muted);
}
.rbr-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--rbr-border);
    border-top-color: var(--rbr-primary);
    border-radius: 50%;
    animation: rbr-spin 0.8s linear infinite;
    margin-bottom: 8px;
}
@keyframes rbr-spin { to { transform: rotate(360deg); } }
.rbr-state[data-state="uploading"] p { margin: 0; font-size: 13px; }

/* Attached */
.rbr-attached-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--rbr-success-bg);
    border: 1px solid var(--rbr-success-border);
    border-radius: 8px;
    padding: 12px 16px;
    color: #2E7D32;
}
.rbr-attached-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--rbr-text);
    min-width: 0;
}
.rbr-attached-label { font-size: 14px; font-weight: 500; }
.rbr-attached-meta  { font-size: 12px; color: var(--rbr-muted); overflow: hidden; text-overflow: ellipsis; }
.rbr-remove-btn {
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--rbr-muted);
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
    font-family: inherit;
}
.rbr-remove-btn:hover { color: var(--rbr-danger); }

/* Error + privacy */
.rbr-error {
    color: var(--rbr-danger);
    font-size: 13px;
    margin: 12px 0 0;
    padding: 10px 12px;
    background: rgba(179,38,30,0.08);
    border-radius: 6px;
}
.rbr-privacy {
    font-size: 11px;
    color: var(--rbr-muted);
    margin: 12px 0 0;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .rbr-state[data-state="choose"] { flex-direction: column; }
    .rbr-record-btn { width: 100%; justify-content: center; }
    .rbr-preview-actions { flex-direction: column; }
    .rbr-attach-btn, .rbr-redo-btn { width: 100%; }
}

/* =========================================
   Reveal mode — big CTA with progressive form
   ========================================= */

.rbr-mode-reveal {
    background: var(--rbr-card-bg);
    border: 1px solid var(--rbr-border);
    border-radius: 12px;
    padding: 48px 32px 36px;
    text-align: center;
}

.rbr-mode-reveal .rbr-state[data-state="choose"] {
    display: block;
}

.rbr-mode-reveal .rbr-headline {
    font-size: 28px;
    font-weight: 400;
    color: var(--rbr-primary);
    margin: 0 auto 12px;
    line-height: 1.25;
    letter-spacing: -0.01em;
    text-align: center !important;
}

.rbr-mode-reveal .rbr-tagline {
    font-size: 15px;
    color: var(--rbr-muted);
    margin: 0 auto 28px !important;
    max-width: 460px;
    line-height: 1.55;
    text-align: center !important;
}

.rbr-mode-reveal .rbr-steps {
    list-style: none;
    padding: 0 !important;
    margin: 0 auto 24px !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--rbr-muted);
    max-width: fit-content;
}

.rbr-steps li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    list-style: none;
}

.rbr-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--rbr-border);
    color: var(--rbr-muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.rbr-step-sep {
    color: var(--rbr-border);
    margin: 0 2px;
}

.rbr-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--rbr-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 16px 36px;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    min-width: 240px;
    line-height: 1;
}
.rbr-cta-btn:hover {
    background: var(--rbr-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.rbr-cta-btn:active { transform: translateY(0); }
.rbr-cta-btn:focus-visible {
    outline: 3px solid rgba(0, 0, 0, 0.15);
    outline: 3px solid color-mix(in srgb, var(--rbr-primary) 35%, transparent);
    outline-offset: 3px;
}

.rbr-secondary-btn {
    display: block;
    margin: 16px auto 0;
    background: transparent;
    color: var(--rbr-primary);
    border: none;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.rbr-secondary-btn:hover { color: var(--rbr-primary-dark); }

.rbr-escape-link {
    display: inline-block;
    margin-top: 28px;
    color: var(--rbr-muted);
    font-size: 13px;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
}
.rbr-escape-link:hover {
    color: var(--rbr-text);
    text-decoration: underline;
}

/* Reveal-mode overrides for shared states (center them) */
.rbr-mode-reveal .rbr-state[data-state="recording"],
.rbr-mode-reveal .rbr-state[data-state="preview"],
.rbr-mode-reveal .rbr-state[data-state="uploading"] {
    padding: 24px 0 12px;
}
.rbr-mode-reveal .rbr-state[data-state="preview"] .rbr-preview-actions {
    justify-content: center;
    max-width: 440px;
    margin: 0 auto;
}
.rbr-mode-reveal .rbr-attached-card {
    max-width: 520px;
    margin: 0 auto;
    text-align: left;
}
.rbr-mode-reveal .rbr-remove-btn {
    background: transparent;
    border: 1px solid var(--rbr-border);
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    color: var(--rbr-muted);
    flex: 0 0 auto;
}
.rbr-mode-reveal .rbr-remove-btn:hover {
    color: var(--rbr-danger);
    border-color: var(--rbr-danger);
}
.rbr-mode-reveal .rbr-next-step {
    text-align: center;
    color: var(--rbr-muted);
    font-size: 14px;
    margin: 16px 0 0;
}

/* Typing escape hatch state */
.rbr-typing-state {
    text-align: center;
    padding: 4px 0;
}
.rbr-typing-note {
    margin: 0;
    font-size: 13px;
}
.rbr-record-instead {
    color: var(--rbr-primary);
    text-decoration: none;
    font-weight: 500;
}
.rbr-record-instead:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rbr-mode-reveal .rbr-error,
.rbr-mode-reveal .rbr-privacy {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

/* Form reveal animation */
.rbr-form-revealed {
    animation: rbr-reveal 0.4s ease-out;
}
@keyframes rbr-reveal {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .rbr-mode-reveal { padding: 32px 20px 24px; }
    .rbr-headline { font-size: 22px; }
    .rbr-tagline { font-size: 14px; }
    .rbr-cta-btn { min-width: 0; width: 100%; }
    .rbr-steps { gap: 6px; font-size: 12px; }
}
