:root {
    --color-fact: #4CAF50;
    /* Green */
    --color-fact-bg: #e8f5e9;
    --color-opinion: #FFC107;
    /* Yellow */
    --color-opinion-bg: #fffde7;
    --color-emotion: #F44336;
    /* Red */
    --color-emotion-bg: #ffebee;
    --color-text: #333;
    --color-bg: #f9f9f9;
}

body {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background-color: #e3f2fd;
    /* Softer Blue BG */
    background-image: radial-gradient(#bbdefb 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--color-text);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 800px;
    background: white;
    padding: 30px;
    border-radius: 30px;
    /* More rounded */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 5px solid #fff;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2em;
    color: var(--color-text);
    margin-bottom: 10px;
}

textarea {
    width: 100%;
    height: 150px;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    box-sizing: border-box;
    /* Important for padding */
    resize: vertical;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: var(--color-fact);
}

.char-count {
    text-align: right;
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* Button Animations & Polish */
.btn-primary {
    display: block;
    width: 100%;
    padding: 15px;
    margin-top: 15px;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    background-color: #2196F3;
    border: none;
    border-radius: 25px;
    /* More rounded */
    cursor: pointer;
    box-shadow: 0 4px 0 #1565C0;
    /* 3D effect */
    transition: transform 0.1s, box-shadow 0.1s;
}

.btn-primary:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #1565C0;
}

.btn-primary:hover {
    background-color: #42A5F5;
}

.btn-primary:disabled {
    background-color: #bbb;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background: #eee;
    padding: 5px;
    border-radius: 15px;
}

.tab-btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-size: 1.1em;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: white;
    color: var(--color-text);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tab-content.hidden {
    display: none;
}

/* Common Input Section */
.input-section {
    margin-bottom: 20px;
}

/* Result Section */
.hidden {
    display: none;
}

.result-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px dashed #eee;
}

.score-container {
    margin-bottom: 20px;
}

.score-label {
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
}

.badgem {
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.9em;
}

.badgem.fact {
    color: var(--color-fact);
    background: var(--color-fact-bg);
}

.badgem.opinion {
    color: var(--color-opinion);
    background: var(--color-opinion-bg);
}

.badgem.emotion {
    color: var(--color-emotion);
    background: var(--color-emotion-bg);
}

.score-bar {
    height: 20px;
    width: 100%;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
}

.bar-segment {
    height: 100%;
    transition: width 0.5s ease-out;
}

.bar-segment.fact {
    background-color: var(--color-fact);
}

.bar-segment.opinion {
    background-color: var(--color-opinion);
}

.bar-segment.emotion {
    background-color: var(--color-emotion);
}

.text-display {
    line-height: 2.0;
    font-size: 1.1em;
    padding: 15px;
    background: #fafafa;
    border-radius: 10px;
    border: 1px solid #eee;
}

/* Text Highlighting */
.segment {
    padding: 2px 4px;
    border-radius: 4px;
    margin: 0 2px;
    border-bottom: 2px solid transparent;
}

.segment.FACT {
    background-color: var(--color-fact-bg);
    border-bottom-color: var(--color-fact);
    cursor: pointer;
}

.segment.OPINION {
    background-color: var(--color-opinion-bg);
    border-bottom-color: var(--color-opinion);
}

.segment.EMOTION {
    background-color: var(--color-emotion-bg);
    border-bottom-color: var(--color-emotion);
}

.segment.FACT:hover {
    filter: brightness(0.95);
}

/* Tooltip or popover for Google Search could go here */

/* Chat Timeline (Debate) */
.chat-timeline {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.chat-bubble {
    background: #f1f2f6;
    padding: 10px 15px;
    border-radius: 15px;
    border-top-left-radius: 2px;
    position: relative;
    max-width: 80%;
}

.chat-speaker {
    font-weight: bold;
    font-size: 0.8em;
    color: #555;
    margin-bottom: 4px;
    display: block;
}

.var-card {
    flex-shrink: 0;
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
    animation: popIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.var-card.YELLOW {
    background: #FFC107;
    color: #333;
}

.var-card.RED {
    background: #F44336;
}

.var-card.GREEN {
    display: none;
}

/* Usually don't show green card? or maybe show clean sign */

.var-comment {
    font-size: 0.9em;
    margin-left: 5px;
    font-weight: normal;
}

@keyframes popIn {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

.referee-btn {
    background-color: #673AB7;
}

.referee-btn:hover {
    background-color: #512DA8;
}

.info-box {
    background: #e3f2fd;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #1565c0;
}

/* AI Comment Box */
.ai-comment-box {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff3e0;
    /* Light Orange */
    border: 2px solid #ffb74d;
    border-radius: 15px;
    position: relative;
}

.ai-comment-box h3 {
    margin-top: 0;
    color: #ef6c00;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-comment-box p {
    margin-bottom: 0;
    line-height: 1.6;
}

/* Rich Tooltip */
.tooltip-menu {
    position: absolute;
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    width: 200px;
    border: 2px solid #e3f2fd;
    animation: popIn 0.2s ease-out;
}

.tooltip-title {
    margin: 0 0 10px 0;
    font-weight: bold;
    color: #555;
    text-align: center;
    font-size: 0.9em;
}

.tooltip-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px;
    margin-bottom: 5px;
    border: none;
    background: #f5f5f5;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    transition: background 0.2s;
}

.tooltip-btn:hover {
    background: #e3f2fd;
    color: #1565c0;
}

.tooltip-btn .icon {
    margin-right: 10px;
}

.tooltip-arrow {
    position: absolute;
    bottom: -10px;
    /* Adjust if putting above */
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #e3f2fd transparent transparent transparent;
}

/* Debate Metrics */
.debate-metrics {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #ddd;
}

.advantage-container {
    margin-bottom: 20px;
    text-align: center;
}

.advantage-bar {
    display: flex;
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    background: #eee;
    margin: 10px 0;
    font-size: 0.9em;
    font-weight: bold;
    color: white;
    line-height: 30px;
}

.adv-segment {
    height: 100%;
    transition: width 0.5s;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Colors will be set via JS or utility classes */

.advantage-labels {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    font-weight: bold;
    color: #555;
    padding: 0 10px;
}

.adv-legend-item {
    display: flex;
    align-items: center;
    font-size: 0.9em;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.profiles-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    /* Scrollbar space */
}

.profile-card {
    flex: 1;
    min-width: 200px;
    background: #fff;
    border: 2px solid #eee;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.profile-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
    color: #333;
}

.profile-type {
    display: inline-block;
    padding: 2px 8px;
    background: #e3f2fd;
    color: #1976D2;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: bold;
    margin-bottom: 10px;
}

.profile-desc {
    font-size: 0.9em;
    color: #666;
    line-height: 1.4;
}

/* Chat Highlight (VAR target) */
.highlight-error {
    background-color: rgba(244, 67, 54, 0.2);
    border-bottom: 2px solid #F44336;
    font-weight: bold;
    padding: 0 2px;
}