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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #ffffff;
    color: #333;
    line-height: 1.5;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

header h1 { font-size: 24px; margin-bottom: 8px; }
.subtitle { color: #666; font-size: 14px; }

.input-section { margin-bottom: 20px; }

#textInput {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

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

.button-group { display: flex; gap: 10px; margin-top: 10px; }

button {
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f5f5f5;
    font-size: 14px;
    cursor: pointer;
}

button:hover { background: #e5e5e5; }

#analyzeBtn {
    background: #4285f4;
    color: white;
    border-color: #4285f4;
}

#analyzeBtn:hover { background: #3367d6; }
#analyzeBtn:disabled { background: #93b8f7; cursor: not-allowed; }

.limit-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
    color: #666;
}

.limit-control label { white-space: nowrap; }

.limit-control input[type="range"] {
    flex: 1;
    max-width: 200px;
    accent-color: #4285f4;
}

#charLimitLabel {
    font-weight: 600;
    color: #333;
    min-width: 70px;
}

.limit-hint { color: #999; font-size: 12px; }

.loading { color: #666; margin-top: 10px; font-style: italic; }

.results-section { margin-top: 30px; }

/* Summary card */
.summary-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 18px;
    margin-bottom: 24px;
}

.summary-card h3 {
    font-size: 15px;
    margin-bottom: 8px;
    color: #495057;
}

.summary-text {
    color: #333;
    line-height: 1.6;
    margin-bottom: 12px;
}

.stats-row {
    display: flex;
    gap: 20px;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
}

.stat {
    font-size: 13px;
    color: #6c757d;
}

.stat strong { color: #333; }

/* Sections */
.section { margin-bottom: 25px; }

.section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #4285f4;
}

/* Highlighted text */
.highlighted-text {
    background: #fafafa;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    line-height: 1.7;
    max-height: 400px;
    overflow-y: auto;
}

.highlight-vocab { background: #ffcdd2; padding: 1px 2px; border-radius: 2px; }
.highlight-structure { background: #fff9c4; padding: 1px 2px; border-radius: 2px; }
.highlight-promo { background: #c8e6c9; padding: 1px 2px; border-radius: 2px; }
.highlight-sig { background: #b3e5fc; padding: 1px 2px; border-radius: 2px; }
.highlight-self-ref { background: #e1bee7; padding: 1px 2px; border-radius: 2px; }

.legend { margin-top: 10px; font-size: 13px; }
.legend-item { display: inline-block; margin-right: 15px; }
.legend-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
}
.legend-color.vocab { background: #ffcdd2; }
.legend-color.structure { background: #fff9c4; }
.legend-color.promo { background: #c8e6c9; }
.legend-color.sig { background: #b3e5fc; }
.legend-color.self-ref { background: #e1bee7; }

/* Flagged phrases */
.flagged-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.flagged-tag {
    background: #fff3e0;
    border: 1px solid #ffe0b2;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 13px;
    color: #e65100;
}

/* Breakdown table */
.breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.breakdown-table th,
.breakdown-table td {
    border: 1px solid #ddd;
    padding: 8px 10px;
    text-align: left;
}

.breakdown-table th { background: #f5f5f5; font-weight: 600; }
.breakdown-table tr:nth-child(even) { background: #fafafa; }

/* Note */
.note {
    background: #fffde7;
    border: 1px solid #fff9c4;
    border-radius: 4px;
    padding: 12px 15px;
    margin-top: 20px;
    font-size: 13px;
    color: #666;
}

.note em { color: #f57f17; }

footer {
    text-align: center;
    padding-top: 20px;
    margin-top: 30px;
    border-top: 1px solid #ddd;
    color: #888;
    font-size: 12px;
}

footer a { color: #4285f4; text-decoration: none; }
footer a:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .container { padding: 15px; }
    .button-group { flex-direction: column; }
    button { width: 100%; }
    .stats-row { flex-direction: column; gap: 6px; }
}
