:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --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: all 0.2s ease-in-out;
}

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

html {
    font-family: 'Source Code Pro', monospace;
    height: 100%;
}

body {
    font-family: 'Source Code Pro', monospace;
    line-height: 1.6;
    color: var(--gray-900);
    background-color: var(--gray-50);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: var(--white);
    padding: 8px;
    text-decoration: none;
    border-radius: var(--border-radius);
    z-index: 1000;
    font-weight: 600;
}

.skip-link:focus {
    top: 6px;
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.header-logo {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
}

/* Support Button */
.info-btn {
    position: fixed;
    top: 1rem;
    right: 8rem;
    z-index: 999;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 1.25rem;
    padding: 0.5rem 1rem;
    height: 2.5rem;
    min-width: 4rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.info-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.info-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.info-btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.support-btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.btn-text {
    font-size: 0.875rem;
    font-weight: 500;
}

.support-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--error);
    color: var(--white);
    border: none;
    border-radius: 1.25rem;
    padding: 0.5rem 1rem;
    height: 2.5rem;
    min-width: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 999;
}

.support-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.support-btn:focus {
    outline: 2px solid var(--error);
    outline-offset: 2px;
}

.support-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Support Drawer */
.support-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease-in-out;
}

.support-drawer.active {
    visibility: visible;
    opacity: 1;
}

.support-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.support-drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--white);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}

.support-drawer.active .support-drawer-content {
    transform: translateX(0);
}

.support-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.support-drawer-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.support-drawer-title i {
    color: var(--primary-color);
}

.support-close-btn {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: 1.25rem;
}

.support-close-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.support-close-btn svg {
    width: 2rem;
    height: 2rem;
}

.support-drawer-body {
    padding: 1.5rem;
}

/* Info Drawer */
.info-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease-in-out;
}

.info-drawer.active {
    visibility: visible;
    opacity: 1;
}

.info-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.info-drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: white;
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.info-drawer.active .info-drawer-content {
    transform: translateX(0);
}

.info-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.info-drawer-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

.info-close-btn {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: 1.25rem;
}

.info-close-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.info-close-btn svg {
    width: 2rem;
    height: 2rem;
}

.info-drawer-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.info-section {
    margin-bottom: 2rem;
}

.info-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.info-section p {
    margin: 0 0 1rem 0;
    line-height: 1.6;
    color: var(--gray-700);
}

.contact-email {
    display: inline-block;
    color: var(--primary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    border-radius: var(--border-radius);
}

.support-description {
    color: var(--gray-600);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.support-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.support-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--gray-900);
    transition: var(--transition);
}

.support-link:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.support-link-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: var(--gray-900);
}

.support-link-content p {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin: 0;
    line-height: 1.4;
}

.support-link i {
    color: var(--primary-color);
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .support-drawer-content {
        width: 100%;
        max-width: none;
    }
    
    .support-btn {
        width: 2rem;
        height: 2rem;
        font-size: 0.875rem;
    }
}

.header .brand-accent {
    color: var(--primary-color);
}

.header p {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: 0.25rem;
}

/* Main content */
.main {
    flex: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

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

.grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    min-height: 600px;
}

/* Editor layout */
.editor-main {
    flex: 1;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    min-height: 0;
}

/* Responsive layout */
@media (max-width: 768px) {
    .editor-main {
        flex-direction: column;
        gap: 1.5rem;
        padding: 0.5rem;
    }
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 280px;
    width: 100%;
}

@media (max-width: 768px) {
    .editor-panel {
        min-width: 0;
        width: 100%;
    }
}

.editor-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0rem;
}

.editor-panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--gray-900);
    font-size: 1.8rem;
    margin: 0;
}

@media (max-width: 768px) {
    .editor-panel-title {
        font-size: 1.5rem;
        justify-content: center;
    }
    
    .header h1 {
        font-size: 2rem;
        text-align: center;
    }
    
    .header p {
        font-size: 1rem;
        text-align: center;
    }
}

.editor-textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: 'Source Code Pro', monospace;
    font-size: 1.6rem;
    line-height: 1.8;
    letter-spacing: 0.05em;
    background: var(--white);
    transition: var(--transition);
    min-height: 0;
}

.editor-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.language-controls {
    display: flex;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

@media (max-width: 768px) {
    .language-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .language-controls .btn-group {
        justify-content: center;
    }
}

.language-controls label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    white-space: nowrap;
}

.language-controls select {
    min-width: 120px;
}

.editor-output {
    background: var(--white);
    color: var(--gray-900);
    font-size: 2rem !important;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

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

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Form elements */
.form-group {
    margin-bottom: 0rem;
    display: flex;
    flex-direction: column;
}

.form-label {
    display: block;
    font-size: 1.5rem !important;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-family: 'Source Code Pro', monospace;
    font-size: 1.125rem;
    line-height: 1.8;
    letter-spacing: 0.05em;
    background: var(--white);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control:disabled {
    background-color: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

.textarea {
    resize: none;
    min-height: 400px;
    font-size: 1.5rem;
    font-family: 'Source Code Pro', monospace;
}

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 1.2rem !important;
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    justify-content: center;
    height: 60px;
    min-width: 100px;
    min-height: 48px;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

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

.btn-secondary {
    background: var(--gray-600);
    color: var(--white);
    border-color: var(--gray-600);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-700);
    border-color: var(--gray-700);
}

.btn-outline {
    background: var(--white);
    color: var(--gray-600);
    border-color: var(--gray-300);
}

.btn-outline:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-lg {
    padding: 1rem 1.5rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

/* Button groups */
.btn-group {
    display: flex;
    gap: 0.5rem;
    margin: 0;
    align-items: center;
}

.btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Controls column */
.controls {
    width: 280px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0rem;
    padding-top: 1rem;
}

/* Auto convert info */
.auto-convert-info {
    width: 100%;
    margin: 1.5rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-light), rgba(59, 130, 246, 0.05));
    border: 1px solid var(--primary-color);
    border-radius: 0.75rem;
    text-align: center;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auto-convert-info i {
    opacity: 0.8;
}



/* Output area */
.output-area {
    flex: 1;
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: 'Source Code Pro', monospace;
    font-size: 1.5rem;
    line-height: 1.8;
    letter-spacing: 0.05em;
    overflow-y: auto;
    min-height: 400px;
    white-space: pre-wrap;
    word-break: break-word;
}

.output-area:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.output-placeholder {
    color: var(--gray-400);
    font-style: italic;
    font-size: 0.875rem;
    text-align: left;
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

.output-example {
    margin-top: 0.5rem;
    margin-bottom: 0;
    padding: 0;
    color: var(--gray-600);
    font-style: normal;
    line-height: 1.6;
}

/* AdSense Banners */
.adsense-banner {
    margin-top: 1rem;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    text-align: center;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.adsense-banner .adsbygoogle {
    max-width: 100%;
    height: auto;
}

/* Responsive AdSense */
@media (max-width: 768px) {
    .adsense-banner .adsbygoogle {
        width: 320px !important;
        height: 50px !important;
    }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--gray-900);
    color: white;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease-out;
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cookie-banner-text {
    flex: 1;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.cookie-banner-actions {
    flex-shrink: 0;
}

.cookie-accept-btn {
    background: #3b82f6;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    color: white;
}

.cookie-accept-btn:hover {
    background: #2563eb;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

/* Responsive Cookie Banner */
@media (max-width: 768px) {
    .cookie-banner-content {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .cookie-banner-text p {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
}

.adsense-placeholder {
    color: var(--gray-500);
}

.adsense-placeholder p {
    margin: 0 0 0.25rem 0;
    font-weight: 500;
    font-size: 0.875rem;
}

.adsense-placeholder small {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Responsive AdSense */
@media (max-width: 768px) {
    .adsense-banner {
        min-height: 50px;
        padding: 0.75rem;
    }
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 0.25rem;
}

/* Hidden utility */
.hidden {
    display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Footer */
.footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    text-align: center;
}

.footer p {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .controls {
        width: 100%;
        order: -1;
    }
    
    .main {
        padding: 1rem;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --gray-100: #e5e5e5;
        --gray-200: #cccccc;
        --gray-300: #999999;
        --primary-light: #b3d9ff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators */
.focus-visible:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Icon styling */
.icon {
    width: 1rem;
    height: 1rem;
    display: inline-block;
}

.icon-sm {
    width: 0.875rem;
    height: 0.875rem;
}

.icon-lg {
    width: 1.25rem;
    height: 1.25rem;
}