:root {
    /* Base Variables - Light Mode by Default, but app respects class="dark" */
    
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-hint: #94a3b8;
    
    --brand-primary: #8b5cf6;
    --brand-primary-hover: #7c3aed;
    --brand-primary-alpha: rgba(139, 92, 246, 0.1);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    
    --transition: 0.2s ease;
}

/* Dark Mode Overrides */
html.dark {
    --bg-app: #0f172a;
    --bg-card: #1e293b;
    --border-color: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-hint: #64748b;
    
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition), color var(--transition);
}

/* Utilities */
.hidden { display: none !important; }

/* App Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    padding: 24px 32px;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--brand-primary);
}
.brand h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}
.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    font-family: inherit;
}
.btn-secondary {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
    background-color: var(--border-color);
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0 32px 40px;
}

.checker-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    align-items: start;
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    transition: background-color var(--transition), border-color var(--transition);
}
.card:last-child {
    margin-bottom: 0;
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Input Styles */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.input-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-swatch-container {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    flex-shrink: 0;
}
.color-swatch-container input[type="color"] {
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    position: absolute;
    top: 0; left: 0;
    z-index: 2;
}
.color-swatch-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.text-input-wrapper {
    position: relative;
    flex: 1;
}
.hash-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-hint);
    font-family: monospace;
    font-size: 16px;
}
.text-input-wrapper input {
    width: 100%;
    height: 48px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 12px 0 28px;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 16px;
    text-transform: uppercase;
    transition: border-color var(--transition);
    outline: none;
}
.text-input-wrapper input:focus {
    border-color: var(--brand-primary);
}

.btn-swap {
    align-self: flex-start;
    margin: 8px 0 8px 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-app);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}
.btn-swap:hover {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    background: var(--brand-primary-alpha);
    transform: rotate(180deg);
}

/* Score Card */
.score-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.score-header h2 {
    font-size: 16px;
    font-weight: 600;
}
.btn-icon[title="Copy Ratio"] { border: none; box-shadow: none; }
.btn-icon[title="Copy Ratio"]:hover { background: var(--border-color); }

.score-value-wrapper {
    display: flex;
    align-items: baseline;
    gap: 4px;
}
.score-value {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    transition: color 0.3s;
}
.score-suffix {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-secondary);
}

.score-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    margin-top: 8px;
}
.score-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background: var(--text-hint);
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.3s;
}
.score-markers .marker {
    position: absolute;
    top: 0; bottom: 0;
    width: 1px;
    background: rgba(0,0,0,0.2);
    z-index: 2;
}
.dark .score-markers .marker { background: rgba(255,255,255,0.3); }

/* Compliance Grid */
.compliance-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.compliance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.compliance-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.item-title {
    font-weight: 500;
    font-size: 15px;
}
.size-hint {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-hint);
    margin-left: 4px;
}
.badges {
    display: flex;
    gap: 8px;
}
.compliance-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    background: var(--border-color);
    color: var(--text-secondary);
    transition: all 0.3s;
    min-width: 80px;
    justify-content: center;
}

/* Badge States */
.compliance-badge.pass {
    background: var(--success-bg);
    color: var(--success);
}
.compliance-badge.fail {
    background: var(--danger-bg);
    color: var(--danger);
}
.badge-req { font-weight: 400; opacity: 0.8; }
.badge-status-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.pass .badge-status-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
}
.fail .badge-status-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
}


/* Preview Area */
.preview-card {
    display: flex;
    flex-direction: column;
}
.preview-area {
    width: 100%;
    min-height: 200px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    transition: background-color 0.3s;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.preview-content {
    max-width: 400px;
    width: 100%;
}
.preview-large-text {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.2;
    transition: color 0.3s;
}
.preview-normal-text {
    font-size: 15px;
    font-weight: 400;
    margin-bottom: 20px;
    line-height: 1.5;
    transition: color 0.3s;
}
.preview-ui-element {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid currentColor;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.3s, border-color 0.3s;
}

/* Suggestions pane */
.suggestions-card { display: flex; flex-direction: column; }
.card-title .badge {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--brand-primary-alpha);
    color: var(--brand-primary);
    margin-left: 8px;
}
.suggestions-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.suggestion-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}
.suggestion-btn:hover {
    background: var(--border-color);
}
.sug-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
}
.sug-hex {
    font-family: monospace;
    font-size: 13px;
    color: var(--text-primary);
    text-transform: uppercase;
}
.sug-ratio {
    font-size: 12px;
    color: var(--success);
    font-weight: 600;
}

/* Toast */
.toast {
    position: fixed;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-app);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.26.5, 1.55);
    z-index: 1000;
    box-shadow: var(--shadow-md);
}
.toast.show {
    bottom: 30px;
    opacity: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .checker-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 600px) {
    .header { padding: 16px 20px; }
    .main-content { padding: 0 20px 20px; }
    .score-value { font-size: 36px; }
    .compliance-item { flex-direction: column; align-items: flex-start; gap: 8px; }
}
