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

body{
    font-family: system-ui, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 20px;
}

main{
    width: 100%;
    max-width: 680px;
}

h1{
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.subtitle{
    color: #64748b;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.textarea-container{
    position: relative;
    width: 100%;
}

textarea{
    width: 100%;
    height: 120px;
    font-size: 1rem;
    font-family: inherit;
    padding: 12px;
    padding-bottom: 30px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    resize: vertical;
    background: #fff;
    color: #1e293b;
    transition: border-color 0.2s;
    display: block;
}

textarea:focus{
    outline: none;
    border-color: #2563eb;
}

.char-counter{
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-family: sans-serif;
    font-size: 12px;
    color: #666;
    pointer-events: none;
}

.length-warning{
    margin-top: 10px;
    padding: 10px 14px;
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 8px;
    color: #854d0e;
    font-size: 0.9rem;
}

.hidden{
    display: none;
}

button{
    margin-top: 12px;
    padding: 10px 28px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

button:hover:not(:disabled){
    background: #1d4ed8;
}

button:disabled{
    background: #93c5fd;
    cursor: not-allowed;
}

#result {
    margin-top: 32px;
}

.winner {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1d4ed8;
    margin-bottom: 18px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 7px 0;
    font-size: 0.9rem;
}

.bar-label {
    width: 170px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #475569;
}

.bar-track {
    flex: 1;
    background: #e2e8f0;
    border-radius: 4px;
    height: 18px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    background: #2563eb;
    width: 0%;
    transition: width 0.45s ease;
}

.bar-pct {
    width: 44px;
    font-size: 0.85rem;
    color: #64748b;
}

.error {
    color: #dc2626;
    font-size: 0.95rem;
}

.spinner {
    color: #94a3b8;
    font-style: italic;
    font-size: 0.95rem;
}

.disclaimer{
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    font-size: 0.8rem;
    font-style: italic;
    color: #888;
    text-align: center;
    padding: 1.1rem;
    background: inherit;
}


#use-count{
    float: right;
    margin-top: 18px;
    margin-bottom: 4px;
    padding: 5px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #2563eb;
}