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

:root {
    /* Shadcn light theme colors (neutral base) */
    --background: 0 0% 100%;
    --foreground: 0 0% 3.9%;
    --muted: 0 0% 96.1%;
    --muted-foreground: 0 0% 45.1%;
    --border: 0 0% 89.8%;
    --input: 0 0% 89.8%;
    --primary: 0 0% 9%;
    --primary-foreground: 0 0% 98%;
    --secondary: 0 0% 96.1%;
    --secondary-foreground: 0 0% 9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --ring: 0 0% 63.9%;
    --radius: 0.5rem;
}

/* 基础样式 */
body {
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    min-height: 100vh;
    padding: 1rem;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 2rem);
}

/* 头部样式 */
.site-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 1rem;
}

.site-header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.subtitle {
    font-size: 1.125rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.6;
}

/* 主要内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-section {
    padding: 0 1rem;
    margin-bottom: 2rem;
}

.result-section {
    padding: 0 1rem;
    margin-top: 2rem;
}

.result-section .btn {
    margin-top: 1.5rem;
}

/* 底部样式 */
.site-footer {
    text-align: center;
    color: hsl(var(--muted-foreground));
    padding: 1.5rem 1rem;
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

.count-display {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

.count-display #countNumber {
    color: hsl(var(--primary));
    font-weight: 600;
}

.site-header .count-display {
    margin: 0.75rem auto 0;
    font-size: 1rem;
    color: hsl(var(--muted-foreground));
}

.site-header .count-display #countNumber {
    color: hsl(var(--primary));
    font-weight: 700;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.125rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 1rem;
}

.form-control {
    display: flex;
    width: 100%;
    height: 2.75rem;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background-color: transparent;
    transition: all 0.15s ease;
    resize: vertical;
    min-height: 120px;
}

.form-control:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
}

.form-control:focus-visible {
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

/* 输入框错误样式 */
.form-control.input-error {
    border-color: hsl(var(--destructive));
    box-shadow: 0 0 0 3px hsl(var(--destructive) / 0.1);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    outline: none;
    border: 1px solid hsl(var(--border));
    padding: 0.625rem 1.125rem;
    height: 2.75rem;
    width: 100%;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
    z-index: 10;
}

.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-primary:hover:not(:disabled) {
    background-color: hsl(var(--muted));
}

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover:not(:disabled) {
    background-color: hsl(var(--muted));
}

/* 结果内容样式 */
.result-content {
    min-height: 120px;
}

.placeholder-text {
    color: hsl(var(--muted-foreground));
    font-style: italic;
    text-align: center;
    padding: 1.5rem;
    font-size: 1rem;
}

.loading {
    color: hsl(var(--foreground));
    text-align: center;
    padding: 1.5rem;
    font-weight: 500;
    font-size: 1rem;
}

.error {
    color: hsl(var(--destructive));
    text-align: center;
    padding: 1.5rem;
    font-size: 1rem;
    background-color: hsl(var(--muted) / 0.5);
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
}

.result-content .result-text {
    font-size: 1rem;
    line-height: 1.7;
    white-space: pre-wrap; /* 保留空白符序列，但是正常地进行换行 */
    word-wrap: break-word; /* 允许长单词或URL地址换行到下一行 */
}

/* 移动端响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .container {
        min-height: calc(100vh - 1.5rem);
    }
    
    .site-header {
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
    }
    
    .site-header h1 {
        font-size: 1.875rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .site-header .count-display {
        font-size: 0.875rem;
        margin: 0.5rem auto 0;
    }
    
    .form-group label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }
    
    .form-control {
        padding: 0.5rem 0.625rem;
        font-size: 0.875rem;
        min-height: 100px;
        height: 2.5rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        height: 2.5rem;
    }
    
    .input-section {
        padding: 0 1rem;
        margin-bottom: 1.5rem;
    }
    
    .result-section {
        padding: 0 1rem;
        margin-top: 1.5rem;
    }
    
    .result-section .btn {
        margin-top: 1.25rem;
    }
    
    .result-content .result-text {
        font-size: 0.875rem;
    }
    
    .placeholder-text,
    .loading,
    .error {
        padding: 1.25rem;
        font-size: 0.875rem;
    }
    
    .site-footer {
        padding: 1.25rem 1rem;
        font-size: 0.75rem;
        margin-top: 1.25rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
        font-size: 0.8125rem;
    }
    
    .site-header {
        padding: 1.25rem 0.75rem;
        margin-bottom: 1.25rem;
    }
    
    .site-header h1 {
        font-size: 1.625rem;
    }
    
    .subtitle {
        font-size: 0.875rem;
    }
    
    .form-group {
        margin-bottom: 0.875rem;
    }
    
    .form-group label {
        font-size: 0.8125rem;
        margin-bottom: 0.25rem;
    }
    
    .form-control {
        padding: 0.375rem 0.5rem;
        font-size: 0.8125rem;
        min-height: 90px;
        height: 2.25rem;
    }
    
    .btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
        height: 2.25rem;
    }
    
    .input-section {
        padding: 0 0.75rem;
        margin-bottom: 1.25rem;
    }
    
    .result-section {
        padding: 0 0.75rem;
        margin-top: 1.25rem;
    }
    
    .result-section .btn {
        margin-top: 1rem;
    }
    
    .site-header .count-display {
        font-size: 0.8125rem;
        margin: 0.5rem auto 0;
    }
    
    .site-footer {
        padding: 1rem 0.75rem;
        font-size: 0.6875rem;
    }
}