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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --accent: #8b5cf6;
    --radius: 12px;
}

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

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

header {
    margin-bottom: 2.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--primary);
}

.logo svg {
    flex-shrink: 0;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    resize: vertical;
    transition: border-color 0.2s;
    background: #f8fafc;
    color: var(--text);
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

textarea::placeholder {
    color: #94a3b8;
}

.actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

button {
    padding: 0.7rem 1.75rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#analyzeBtn {
    background: var(--primary);
    color: #fff;
}

#analyzeBtn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

button.secondary {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

button.secondary:hover {
    background: #e2e8f0;
    color: var(--text);
}

.result-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    animation: fadeIn 0.3s ease;
}

.result-section.hidden {
    display: none;
}

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

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.result-header h2 {
    font-size: 1.25rem;
    color: var(--text);
}

.stats {
    display: flex;
    gap: 0.5rem;
}

.stat-badge {
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #ede9fe;
    color: var(--accent);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: #f1f5f9;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

thead th:first-child {
    border-radius: 8px 0 0 0;
    width: 50px;
}

thead th:last-child {
    border-radius: 0 8px 0 0;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody td {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
}

tbody td:first-child {
    color: var(--text-muted);
    font-size: 0.8rem;
}

tbody td:nth-child(2) {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-weight: 600;
    color: var(--primary-dark);
}

tbody td:nth-child(3) {
    font-weight: 700;
    color: var(--text);
}

.bar-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bar {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.5s ease;
}

.bar-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
}

@media (max-width: 600px) {
    .container { padding: 1rem; }
    h1 { font-size: 1.3rem; }
    .result-header { flex-direction: column; align-items: flex-start; }
    textarea { min-height: 150px; }
}
