:root {
    --primary: #4F46E5; --primary-hover: #4338CA; --background: #f8f9fa; --text: #212529; --text-muted: #6c757d; --card: #ffffff; --border: #dee2e6; --success: #198754; --success-bg: #d1e7dd; --danger: #dc3545; --danger-bg: #f8d7da; --level-aa-bg: #e0e7ff; --level-aa-text: #3730a3; --level-aaa-bg: #f3e8ff; --level-aaa-text: #7e22ce; --focus-ring-color: rgba(79, 70, 229, 0.4);
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; }
body { background-color: var(--background); color: var(--text); min-height: 100vh; padding: 2rem 1rem; display: flex; flex-direction: column; align-items: center; line-height: 1.6; }
.container { width: 100%; max-width: 900px; margin: 0 auto; }
header { text-align: center; margin-bottom: 3rem; }
h1 { font-size: 1.8rem; margin-bottom: 0.75rem; color: var(--primary); font-weight: 700; }
.description { font-size: 1.1rem; color: var(--text-muted); max-width: 650px; margin: 0 auto 2rem auto; }
.card { background-color: var(--card); border-radius: 16px; padding: 2.5rem; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); margin-bottom: 2.5rem; width: 100%; }
.color-inputs { display: flex; flex-wrap: wrap; gap: 2rem; margin-bottom: 1.5rem; justify-content: space-between; }
.color-input { flex: 1; min-width: 280px; }
.color-input label { display: block; margin-bottom: 0.75rem; font-weight: 600; color: var(--text); }
.color-picker { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.color-picker input[type="color"] { width: 50px; height: 50px; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; padding: 0; -webkit-appearance: none; appearance: none; overflow: hidden; }
.color-picker input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
.color-picker input[type="color"]::-moz-color-swatch { border: none; border-radius: 6px; }
.color-picker input[type="text"] { flex: 1; padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.color-picker input[type="text"]:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring-color); }
.color-picker input[type="text"][aria-invalid="true"] { border-color: var(--danger); }
.color-picker input[type="text"][aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.4); }

.contrast-ratio-display {
    margin-top: 1.5rem; margin-bottom: 2rem; padding: 1rem 1.5rem; background-color: var(--background); border: 1px solid var(--border); border-radius: 8px; font-size: 1.1rem; display: flex; justify-content: space-between; align-items: center;
}
.contrast-ratio-display .result-label { font-weight: 600; color: var(--text); }
.contrast-ratio-display .contrast-ratio-value { font-weight: 700; font-size: 1.1rem; color: var(--primary); }

.preview-result-container { display: flex; flex-direction: column; gap: 2rem; margin-bottom: 2rem; }

.preview-section { display: flex; flex-wrap: wrap; gap: 1.5rem; border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; background-color: #fff; }

.preview-box { flex: 2; min-width: 220px; padding: 1.5rem; border-radius: 8px; transition: background-color 0.3s ease, color 0.3s ease; display: flex; flex-direction: column; gap: 0.8rem; border: 1px solid var(--border); }
.preview-text-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; padding-bottom: 0.3rem; border-bottom: 1px dashed var(--border); display: inline-block; }
.preview-box p { margin: 0; }
#previewTextNormal { font-size: 1rem; font-weight: 400; line-height: 1.5; }
#previewTextLarge { font-size: 1.5rem; font-weight: 400; line-height: 1.5; }

.result-badges {
    flex: 1; min-width: 240px; display: flex; flex-direction: column; justify-content: center; gap: 1rem;
}
.result-badges .result-item {
    padding: 0.6rem 0; border-bottom: none; display: flex; justify-content: space-between; align-items: center;
}
.result-badges .result-label {
    font-size: 1.05rem;
    color: var(--text-muted); display: flex; align-items: center; gap: 0.5em;
}
.result-badges .result-label .level-badge {
    font-size: 0.78em;
    top: -0.03em;
    margin-left: 0;
    margin-right: 0.2em;
}
.result-badges .badge {
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    min-width: 65px;
}

.badge {
     border-radius: 50px; font-weight: 600; text-align: center;
}
.badge-success { background-color: var(--success-bg); color: var(--success); }
.badge-fail { background-color: var(--danger-bg); color: var(--danger); }
.level-badge { display: inline-block; padding: 0.15em 0.5em; font-weight: 700; line-height: 1; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: 0.375rem; position: relative; }
.level-badge.level-aa { background-color: var(--level-aa-bg); color: var(--level-aa-text); }
.level-badge.level-aaa { background-color: var(--level-aaa-bg); color: var(--level-aaa-text); }
.toggle-button { background-color: var(--primary); color: white; border: none; padding: 0.8rem 1.8rem; border-radius: 8px; font-size: 1rem; font-weight: 500; cursor: pointer; transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.2s ease; display: block; margin: 0 auto; }
.toggle-button:hover { background-color: var(--primary-hover); }
.toggle-button:active { transform: scale(0.98); }
.toggle-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring-color); }
.content-section { background-color: var(--card); border-radius: 16px; padding: 2.5rem; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); margin-bottom: 2.5rem; width: 100%; }
.content-section h2 { font-size: 1.6rem; margin-bottom: 1.5rem; color: var(--primary); font-weight: 600; border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; }
.content-section h3 { font-size: 1.3rem; margin-top: 2rem; margin-bottom: 1rem; color: var(--text); font-weight: 600; }
.content-section h3:first-of-type { margin-top: 0; }
.content-section p, .content-section ul, .content-section dl { margin-bottom: 1rem; color: var(--text-muted); line-height: 1.7; }
.content-section ul { padding-left: 1.5rem; }
.content-section li { margin-bottom: 0.5rem; }
.content-section a { color: var(--primary); text-decoration: none; transition: color 0.2s ease; }
.content-section a:hover { color: var(--primary-hover); text-decoration: underline; }
.content-section strong { font-weight: 600; color: var(--text); }
.content-section code { font-family: monospace; background-color: #e9ecef; padding: 0.2em 0.4em; border-radius: 3px; font-size: 0.9em; }
.faq-list { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.faq-list dt { font-weight: 600; color: var(--text); margin-top: 1.8rem; margin-bottom: 0.6rem; font-size: 1.15rem; }
.faq-list dt:first-of-type { margin-top: 0; }
.faq-list dd { margin-left: 0; margin-bottom: 1rem; padding-left: 1.2rem; border-left: 3px solid var(--primary); color: var(--text-muted); font-size: 0.95rem; }
.faq-list dd p { margin-bottom: 0.5rem; }
.faq-list dd p:last-child { margin-bottom: 0; }
.faq-list dd strong { color: var(--text); }
footer { margin-top: 3rem; text-align: center; font-size: 0.9rem; color: var(--text-muted); }

@media (max-width: 768px) {
    body { padding: 1.5rem 0.5rem; }
    h1 { font-size: 1.8rem; }
    .description { font-size: 1rem; padding: 0 5px; }
    .card, .content-section { padding: 1.5rem; border-radius: 12px; }
    .color-inputs { flex-direction: column; gap: 1.5rem; }
    .color-input { min-width: 100%; }
    .preview-section { flex-direction: column; }
    .preview-box, .result-badges { min-width: 100%; flex: none; }
    #previewTextNormal { font-size: 0.9rem; }
    #previewTextLarge { font-size: 1.3rem; }
     .result-badges .result-label {
        font-size: 1rem;
     }
     .result-badges .badge {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
        min-width: 60px;
     }
    .content-section h2 { font-size: 1.5rem; }
    .content-section h3 { font-size: 1.2rem; }
    .faq-list dt { font-size: 1.1rem; }
    .faq-list dd { font-size: 0.9rem; }
    .level-badge { font-size: 0.7em; }
}