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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f4;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 40px;
}

.header-text h1 {
    font-size: 2em;
    margin-bottom: 4px;
    font-weight: 700;
    color: #222;
}

.header-text p {
    font-size: 1em;
    color: #666;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    max-width: 320px;
}

.search-icon {
    font-size: 0.95em;
    line-height: 1;
    filter: grayscale(1);
    opacity: 0.55;
}

.search-box input {
    flex: 1;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
    background: white;
    transition: border-color 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #999;
}

.filters {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-icon {
    font-size: 0.95em;
    color: #999;
    line-height: 1;
}

select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
    background: white;
    transition: border-color 0.2s ease;
}

select:focus {
    outline: none;
    border-color: #999;
}

.stats {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.stat-item {
    background: white;
    padding: 12px 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    text-align: center;
    min-width: 100px;
}

.stat-number {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    color: #222;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ideas-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.idea-card {
    background: white;
    padding: 24px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    position: relative;
    cursor: pointer;
}

.idea-card:hover {
    border-color: #bbb;
}

.idea-card.voted {
    border-left: 4px solid #4CAF50;
}

.idea-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.idea-header .vote-button {
    flex-shrink: 0;
}

.idea-title {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 0;
    color: #333;
    line-height: 1.3;
}

.idea-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 1.05em;
}

.idea-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.questions-toggle-hint {
    font-size: 0.8em;
    color: #999;
    user-select: none;
}

.idea-card.expanded .questions-toggle-hint {
    color: #555;
}

/* Questions panel */
.questions-panel {
    display: none;
    border-top: 1px solid #eee;
    padding-top: 16px;
    margin-top: 4px;
}

.idea-card.expanded .questions-panel {
    display: block;
}

.questions-loading,
.questions-error {
    font-size: 0.9em;
    color: #999;
    padding: 8px 0;
}

.questions-error {
    color: #c0392b;
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.no-questions {
    font-size: 0.9em;
    color: #aaa;
    padding: 4px 0;
}

.question-item {
    background: #f8f8f8;
    border-radius: 4px;
    padding: 10px 12px;
}

.question-text {
    font-size: 0.95em;
    color: #444;
    line-height: 1.5;
}

.answer-item {
    margin-top: 6px;
    padding-left: 12px;
    border-left: 2px solid #ddd;
}

.answer-text {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
}

.question-input-area {
    display: flex;
    gap: 8px;
}

.question-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    color: #333;
    background: white;
    transition: border-color 0.2s ease;
}

.question-input:focus {
    outline: none;
    border-color: #999;
}

.question-submit {
    padding: 7px 14px;
    background: #444;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.2s ease;
}

.question-submit:hover:not(:disabled) {
    background: #222;
}

.question-submit:disabled {
    background: #aaa;
    cursor: default;
}

.question-error {
    font-size: 0.85em;
    color: #c0392b;
    padding: 6px 0;
}

.idea-category {
    background: #ebebeb;
    color: #444;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
}

.idea-date {
    font-size: 0.8em;
    color: #999;
}

.vote-button {
    background: none;
    color: #aaa;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.vote-button:hover:not(:disabled) {
    color: #e05555;
    border-color: #e05555;
}

.vote-button.voted {
    color: #e05555;
    border-color: #e05555;
}

.vote-button:disabled {
    cursor: default;
}

.vote-count {
    font-weight: 600;
    color: #444;
    display: flex;
    align-items: center;
    gap: 5px;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.1em;
    color: #888;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state h3 {
    font-size: 1.3em;
    margin-bottom: 10px;
    color: #555;
}

.empty-state p {
    opacity: 0.8;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .controls {
        flex-direction: column;
        gap: 15px;
    }

    .stats {
        width: 100%;
    }

    .ideas-container {
        grid-template-columns: 1fr;
    }

    .idea-card {
        padding: 20px;
    }
}
/* --- Lifecycle stage badge --- */

.stage-badge {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
}

.stage-badge.stage-start {
    background: #f4f4f4;
    color: #999;
}

.stage-badge.stage-progressed {
    background: #fdeeee;
    color: #e05555;
}

/* --- Journey button --- */

.journey-button {
    background: none;
    border: 1px solid #ddd;
    color: #666;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.journey-button:hover {
    color: #e05555;
    border-color: #e05555;
}

/* --- Answered chip on questions --- */

.answered-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 10px;
    background: #eaf6ec;
    color: #3d8b4f;
    font-size: 0.75em;
    font-weight: 500;
    white-space: nowrap;
}

/* --- Journey modal --- */

.journey-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 100;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}

.journey-modal {
    background: white;
    border-radius: 8px;
    max-width: 720px;
    width: 100%;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.journey-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 14px;
    border-bottom: 1px solid #eee;
}

.journey-header h2 {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 8px;
}

.journey-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
}

.journey-close:hover {
    color: #333;
}

.journey-content {
    padding: 8px 24px 24px;
    overflow-y: auto;
}

.journey-loading {
    padding: 32px;
    text-align: center;
    color: #aaa;
}

.journey-artifact {
    margin-top: 20px;
}

.journey-artifact h3 {
    font-size: 1em;
    color: #e05555;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f4f4f4;
}

/* --- Rendered markdown --- */

.markdown-body {
    font-size: 0.92em;
    color: #444;
    line-height: 1.6;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    color: #333;
    margin: 14px 0 6px;
}

.markdown-body h1 { font-size: 1.15em; }
.markdown-body h2 { font-size: 1.05em; }
.markdown-body h3 { font-size: 1em; }

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
    margin-bottom: 8px;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 22px;
}

.markdown-body code {
    background: #f4f4f4;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.9em;
}

.markdown-body pre {
    background: #f8f8f8;
    border-radius: 4px;
    padding: 10px 12px;
    overflow-x: auto;
    margin-bottom: 8px;
}

.markdown-body blockquote {
    border-left: 3px solid #ddd;
    padding-left: 12px;
    color: #777;
    margin-bottom: 8px;
}

.markdown-body table {
    border-collapse: collapse;
    margin-bottom: 8px;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid #e5e5e5;
    padding: 4px 10px;
    text-align: left;
}

/* --- Share buttons (revealed on hover where hover exists) --- */

.share-group {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
    margin-right: 50px;
}

.share-button {
    background: none;
    border: none;
    color: #bbb;
    font-size: 0.85em;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.share-button:hover {
    color: #e05555;
    background: #f8f8f8;
}

.share-button.copied {
    color: #3d8b4f;
}

/* Hide until hover only on devices that can hover; stay visible on touch */
@media (hover: hover) {
    .idea-card .share-group {
        opacity: 0;
        transition: opacity 0.15s ease;
    }

    .idea-card:hover .share-group,
    .idea-card:focus-within .share-group {
        opacity: 1;
    }
}

/* --- News ticker (activity log) --- */

.news-ticker {
    display: flex;
    align-items: stretch;
    background: #1a1a1a;
    color: #d8d8d8;
    border-radius: 4px;
    height: 32px;
    margin-bottom: 24px;
    overflow: hidden;
}

.news-ticker-label {
    flex-shrink: 0;
    background: #e05555;
    color: white;
    padding: 0 12px;
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
}

.news-ticker-track {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.news-ticker-content {
    display: inline-block;
    white-space: nowrap;
    font-size: 0.82em;
    padding-left: 16px;
    animation: news-ticker-scroll 120s linear infinite;
}

@keyframes news-ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* --- Permalink target highlight --- */

.permalink-highlight {
    box-shadow: 0 0 0 2px #e05555, 0 6px 24px rgba(224, 85, 85, 0.25);
    transition: box-shadow 0.4s ease;
}
