:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --accent: #a855f7;
    --success: #22c55e;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; }
.container { max-width: 1200px; margin: 0 auto; padding: 12px; }
.back-link { display: inline-block; color: var(--text-muted); text-decoration: none; margin-bottom: 8px; font-size: 0.85rem; transition: color 0.2s; }
.back-link:hover { color: var(--primary); }
header { text-align: center; padding: 12px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
header h1 { font-size: 1.4rem; margin-bottom: 2px; background: linear-gradient(135deg, #6366f1, #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
header p { color: var(--text-muted); font-size: 0.85rem; }

.main-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .main-layout { grid-template-columns: 1fr; } }

.input-section { display: flex; flex-direction: column; }
.pane-header {
    padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border);
    border-bottom: none; border-radius: 8px 8px 0 0; font-size: 0.8rem;
    color: var(--text-muted); font-weight: 600; text-transform: uppercase;
    display: flex; justify-content: space-between; align-items: center;
}
.header-actions { display: flex; gap: 4px; }
.text-btn { background: transparent; border: none; color: var(--primary); cursor: pointer; font-size: 0.75rem; padding: 2px 6px; }
.text-btn:hover { text-decoration: underline; }

#text-input {
    flex: 1; min-height: 500px; padding: 14px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 0 0 8px 8px;
    color: var(--text); font-family: 'Consolas', 'Fira Code', monospace;
    font-size: 0.9rem; resize: vertical; outline: none; line-height: 1.6;
}
#text-input:focus { border-color: var(--primary); }

.stats-section { display: flex; flex-direction: column; gap: 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 600px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    padding: 12px; text-align: center; transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--primary); }
.stat-card.primary { border-color: var(--primary); background: rgba(99,102,241,0.1); }
.stat-card.accent { border-color: var(--accent); background: rgba(168,85,247,0.08); }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin-bottom: 2px; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.detail-section {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 14px;
}
.detail-section h3 { font-size: 0.85rem; color: var(--primary); margin-bottom: 10px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-item { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid rgba(51,65,85,0.5); }
.detail-label { font-size: 0.8rem; color: var(--text-muted); }
.detail-value { font-size: 0.8rem; font-weight: 500; }

.top-words { display: flex; flex-wrap: wrap; gap: 6px; }
.word-tag {
    padding: 3px 8px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 4px; font-size: 0.75rem; display: flex; align-items: center; gap: 4px;
}
.word-tag .count { color: var(--primary); font-weight: 600; }
.muted { color: var(--text-muted); font-size: 0.8rem; }

.char-breakdown { display: flex; flex-direction: column; gap: 6px; }
.char-bar-item { display: grid; grid-template-columns: 80px 1fr 40px; align-items: center; gap: 8px; font-size: 0.8rem; }
.bar-wrap { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; width: 0; }
