:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #151520;
    --bg-hover: #1e1e2d;
    --text-primary: #f5f5f7;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b80;
    --border-color: #2a2a3a;
    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --ai-highlight: rgba(239, 68, 68, 0.2);
    --human-highlight: rgba(34, 197, 94, 0.2);
    --mixed-highlight: rgba(245, 158, 11, 0.2);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: 200ms ease;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f0f1f3;
    --bg-card: #ffffff;
    --bg-hover: #e9ecef;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-muted: #8b8b9e;
    --border-color: #e0e0e8;
    --ai-highlight: rgba(239, 68, 68, 0.15);
    --human-highlight: rgba(34, 197, 94, 0.15);
    --mixed-highlight: rgba(245, 158, 11, 0.15);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-primary);
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.theme-icon-light,
.theme-icon-dark {
    width: 20px;
    height: 20px;
}

.theme-icon-light {
    display: none;
}

.theme-icon-dark {
    display: block;
}

[data-theme="light"] .theme-icon-light {
    display: block;
}

[data-theme="light"] .theme-icon-dark {
    display: none;
}

.hero {
    text-align: center;
    padding: 60px 0 40px;
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 16px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 20px;
}

.hero-badges {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--text-secondary);
}

.app-section {
    padding: 40px 0;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.input-panel,
.output-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.word-count {
    font-size: 13px;
    color: var(--text-muted);
}

textarea {
    width: 100%;
    height: 280px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.7;
    resize: vertical;
    font-family: inherit;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea::placeholder {
    color: var(--text-muted);
}

.panel-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 16px;
}

.rewrite-level {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rewrite-level label {
    font-size: 14px;
    color: var(--text-secondary);
}

.level-buttons {
    display: flex;
    gap: 8px;
}

.level-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.level-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.level-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.btn-primary {
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.output-content {
    min-height: 280px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 15px;
    line-height: 1.7;
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 240px;
    color: var(--text-muted);
    text-align: center;
}

.placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.placeholder p {
    font-size: 14px;
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary svg {
    width: 16px;
    height: 16px;
}

.output-actions {
    display: flex;
    gap: 8px;
}

.detector-section {
    padding: 40px 0;
}

.detector-section h2 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 32px;
}

.detector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.detector-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.detector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.detector-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.btn-scan {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-scan:hover:not(:disabled) {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.btn-scan:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.score-circle {
    position: relative;
    width: 120px;
    height: 120px;
}

.score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 8;
}

.score-fill {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 251.2;
    stroke-dashoffset: 251.2;
    transition: stroke-dashoffset 0.8s ease, stroke 0.3s ease;
}

.score-fill.high {
    stroke: var(--danger);
}

.score-fill.medium {
    stroke: var(--warning);
}

.score-fill.low {
    stroke: var(--success);
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 700;
}

.score-label {
    font-size: 14px;
    color: var(--text-muted);
}

.analysis-section {
    padding: 40px 0;
}

.analysis-section h2 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.ai {
    background: var(--danger);
}

.legend-dot.human {
    background: var(--success);
}

.legend-dot.mixed {
    background: var(--warning);
}

.analysis-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    font-size: 15px;
    line-height: 1.8;
}

.analysis-content .sentence {
    display: inline;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    transition: var(--transition);
}

.analysis-content .sentence:hover {
    filter: brightness(1.2);
}

.analysis-content .sentence.ai {
    background: var(--ai-highlight);
}

.analysis-content .sentence.human {
    background: var(--human-highlight);
}

.analysis-content .sentence.mixed {
    background: var(--mixed-highlight);
}

.features-section {
    padding: 60px 0;
}

.features-section h2 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 8px;
}

.features-section h3 {
    text-align: center;
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.feature-card h4 {
    font-size: 16px;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
}

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.original-sentence {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
}

.rewrite-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rewrite-option {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.rewrite-option:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.rewrite-option.selected {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-primary);
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@media (max-width: 900px) {
    .app-grid,
    .detector-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .hero h1 {
        font-size: 36px;
    }
}

@media (max-width: 600px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .panel-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .level-buttons {
        justify-content: center;
    }
    
    .btn-primary {
        justify-content: center;
    }
    
    .hero h1 {
        font-size: 28px;
    }
    
    .hero p {
        font-size: 16px;
    }
}
