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

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    min-height: 100vh;
}

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

.container-wide {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.nav {
    margin-bottom: 2rem;
}

.nav a {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.9rem;
}

.nav a:hover {
    color: #2c3e50;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: #6c757d;
    font-size: 1rem;
}

.form-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #2c3e50;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.btn {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
}

.btn:hover {
    background: #34495e;
}

.result-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
}

.result-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.result-output {
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.75rem;
    font-family: "Courier New", monospace;
    font-size: 0.9rem;
    word-break: break-all;
    min-height: 2.5rem;
    color: #495057;
}

.error-message,
.error-result {
    color: #dc3545;
    font-weight: 500;
}

.error-result {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.success-result {
    color: #28a745;
    font-weight: 500;
}

.valid-result {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.copy-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background-color 0.2s ease;
}

.copy-button:hover {
    background: #218838;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-item input[type="checkbox"],
.checkbox-item input[type="radio"] {
    width: auto;
    margin: 0;
}

.checkbox-item label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

.operation-toggle {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.operation-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.operation-option input[type="radio"] {
    margin: 0;
}

.operation-option label {
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
}

.status-indicator {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.status-valid {
    background: #d4edda;
    color: #155724;
}

.status-invalid {
    background: #f8d7da;
    color: #721c24;
}

.form-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

.length-display {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.length-value {
    font-weight: bold;
    color: #2c3e50;
    font-size: 1.2rem;
    min-width: 3rem;
}

.strength-meter {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
}

.strength-weak {
    background: #f8d7da;
    color: #721c24;
}

.strength-medium {
    background: #fff3cd;
    color: #856404;
}

.strength-strong {
    background: #d4edda;
    color: #155724;
}

.input-section {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 2rem;
    margin-bottom: 2rem;
}

.input-type-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-type-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-type-option input[type="radio"] {
    width: auto;
    margin: 0;
}

.input-type-option label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

.color-preview {
    width: 100%;
    height: 150px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #ffffff;
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position:
        0 0,
        0 10px,
        10px -10px,
        -10px 0px;
    position: relative;
}

.color-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: white;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.result-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
}

.result-label {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.result-value {
    font-family: "Courier New", monospace;
    font-size: 1.1rem;
    color: #495057;
    word-break: break-all;
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #ced4da;
}

.encode-result {
    background-color: #e8f5e8;
    border-color: #28a745;
}

.decode-result {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.info-box {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #1565c0;
}

@media (max-width: 768px) {
    .container,
    .container-wide {
        padding: 1rem;
    }

    .form-section {
        padding: 1.5rem;
    }

    .form-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .input-section {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

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

    .results-grid {
        grid-template-columns: 1fr;
    }

    .operation-toggle {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .checkbox-group {
        grid-template-columns: 1fr;
    }
}
