body {
    background: radial-gradient(1200px 600px at 20% 0%, #eef5ff 0%, #f8f9fa 55%, #f8f9fa 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #1f2937;
}

.card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

.app-card {
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12) !important;
}

.app-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#start-btn, #record-btn, #stop-btn, #send-btn {
    padding: 12px 30px;
    font-size: 1.2rem;
    border-radius: 50px;
    transition: all 0.3s ease;
}

#start-btn {
    padding: 15px 50px;
}

#recording-ui {
    transition: all 0.3s ease;
}

#audio-visualizer {
    width: 100%;
    height: 60px;
    margin: 10px 0;
    background-color: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
}

.app-conversation {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 14px;
    height: min(52vh, 520px);
}

/* Better scrollbars (best-effort) */
.app-conversation {
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.25) transparent;
}
.app-conversation::-webkit-scrollbar {
    width: 10px;
}
.app-conversation::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

#visualizer {
    width: 100%;
    height: 100%;
}

.message {
    margin: 15px 0;
    padding: 15px;
    border-radius: 15px;
    max-width: 80%;
    position: relative;
    clear: both;
}

.assistant-message {
    background-color: #e9ecef;
    float: left;
    border-bottom-left-radius: 5px;
}

.user-message {
    background-color: #0d6efd;
    color: white;
    float: right;
    border-bottom-right-radius: 5px;
}

#status {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 20px;
}

/* Only show the spinner while recording */
#status .spinner-border {
    display: none;
}

#status.recording .spinner-border {
    display: inline-block;
}

#status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#status-text {
    font-weight: 600;
}

.recording {
    animation: pulse 1.5s infinite;
}

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

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background-color: #ffca2c;
    border-color: #ffc720;
    color: #000;
}

/* Topic selection styles */
.topic-item {
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Story list items */
.story-item {
    background: #ffffff;
    border-color: #e9ecef !important;
}

.story-item:hover {
    border-color: rgba(13, 110, 253, 0.35) !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.story-item-top {
    min-height: 34px;
}

.story-item-badges .badge {
    font-weight: 600;
}

.story-item-action .btn {
    white-space: nowrap;
}

.story-item-title {
    font-size: 1.02rem;
}

.story-item-desc {
    margin-top: 2px;
}

/* Chat message bubble polish for existing markup */
#conversation .p-3.rounded-3 {
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    line-height: 1.45;
}

#conversation .bg-light {
    background-color: #f3f4f6 !important;
}

#conversation .bg-primary {
    background: linear-gradient(180deg, #0d6efd 0%, #0b5ed7 100%) !important;
}

#conversation .small.text-muted {
    opacity: 0.8;
}

@media (max-width: 576px) {
    #start-btn, #record-btn, #stop-btn, #send-btn {
        font-size: 1.05rem;
        padding: 12px 18px;
    }

    .app-conversation {
        height: 55vh;
    }
}

.topic-item:hover {
    background-color: #f8f9fa;
    border-color: #0d6efd;
    transform: translateY(-2px);
}

.topic-item.border-primary {
    border-color: #0d6efd;
    background-color: #e7f3ff;
}

.topic-item h6 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.topic-item small {
    font-size: 0.875rem;
    line-height: 1.4;
}

#custom-title {
    border-radius: 0 50px 50px 0;
}

#use-custom-title {
    border-radius: 0 50px 50px 0;
}
