:root {
    --primary: #3B82F6;
    --primary-hover: #2563EB;
    --accent: #10B981;
    --accent-hover: #059669;
    --bg: #0F172A;
    --bg-panel: rgba(30, 41, 59, 0.75);
    --border: rgba(255, 255, 255, 0.08);
    --text: #F1F5F9;
    --text-muted: #94A3B8;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;
    --radius: 12px;
    --transition: all 0.25s ease;
}

[data-theme="light"] {
    --bg: #F8FAFC;
    --bg-panel: rgba(255, 255, 255, 0.85);
    --border: rgba(0, 0, 0, 0.08);
    --text: #1E293B;
    --text-muted: #64748B;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background: radial-gradient(ellipse at top left, rgba(59, 130, 246, 0.08), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(16, 185, 129, 0.06), transparent 50%),
        var(--bg);
    transition: background 0.3s ease, color 0.3s ease;
}

.app {
    width: 100%;
    max-width: 900px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Header */
header {
    padding: 1.25rem 1.5rem;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    border-color: var(--primary);
}

/* Cards */
.card {
    padding: 1.5rem;
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.input-header h2 {
    border: none;
    padding: 0;
    margin: 0;
}

.input-actions {
    display: flex;
    gap: 0.4rem;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    resize: vertical;
    transition: var(--transition);
    line-height: 1.5;
}

[data-theme="light"] textarea {
    background: rgba(0, 0, 0, 0.04);
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 0.55rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    color: #fff;
}

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

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Score */
.score-section {
    padding: 1.25rem 1.5rem;
}

.score-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.score-ring-wrap {
    position: relative;
    width: 90px;
    height: 90px;
}

.score-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 8;
}

[data-theme="light"] .ring-bg {
    stroke: rgba(0, 0, 0, 0.06);
}

.ring-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.score-num {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.4rem;
    font-weight: 700;
}

.score-detail {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.score-grade {
    font-size: 1.2rem;
    font-weight: 700;
}

.score-info {
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 320px;
}

.score-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Results */
.result-item {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--border);
    transition: var(--transition);
}

[data-theme="light"] .result-item {
    background: rgba(0, 0, 0, 0.03);
}

.result-item:hover {
    transform: translateX(2px);
}

.result-item.pass {
    border-left-color: var(--success);
}

.result-item.warn {
    border-left-color: var(--warning);
}

.result-item.fail {
    border-left-color: var(--error);
}

.result-item.info {
    border-left-color: var(--info);
}

.result-header {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-value {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin: 0.3rem 0;
    display: inline-block;
    word-break: break-all;
}

.result-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* History */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}

.history-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

.history-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.muted {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* Footer */
footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

kbd {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

@media (max-width: 640px) {
    .score-row {
        flex-direction: column;
        text-align: center;
    }

    .input-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn {
        width: 100%;
    }
}