:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --success: #10b981;
    --bg: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --text: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 6px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-secondary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1.75rem 0;
}

header h1 a {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

header h1 a:hover {
    color: var(--primary);
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Main */
main {
    padding: 2rem 0;
}

/* Tool Header */
.tool-header {
    margin-bottom: 1.75rem;
}

.tool-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.tool-header p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

/* Tool Content */
.tool-content {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

/* Forms */
label {
    display: block;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

textarea,
input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    transition: all 0.15s ease;
    background: var(--bg);
}

textarea:focus,
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

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

/* Buttons */
button {
    cursor: pointer;
    border: none;
    font-weight: 500;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-tertiary);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* Input/Output Sections */
.input-section,
.output-section {
    margin-bottom: 1.5rem;
}

.output-section {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.25rem;
    min-height: 120px;
}

/* Tool Info */
.tool-info {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
}

.tool-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
}

.tool-info ul {
    list-style: none;
    margin-bottom: 1.5rem;
}

.tool-info li {
    padding: 0.5rem 0;
    padding-left: 1.25rem;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tool-info li:before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--primary);
}

details {
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem;
    transition: border-color 0.15s ease;
}

details:hover {
    border-color: var(--text-tertiary);
}

summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--text);
    user-select: none;
}

details p {
    margin-top: 0.625rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Tools Grid (Homepage) */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 1.75rem;
}

.tool-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s ease;
}

.tool-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tool-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text);
}

.tool-card p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* QR Code */
.qr-canvas {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.qr-canvas canvas {
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.875rem;
    margin: 1rem 0;
}

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

.option-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.option-group select,
.option-group input[type="color"] {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.option-group input[type="color"] {
    height: 38px;
    cursor: pointer;
}

/* Color Tool */
.color-preview-section {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.color-preview {
    flex: 1;
    height: 140px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

#color-picker {
    width: 90px;
    height: 140px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

.color-formats {
    display: grid;
    gap: 1rem;
}

.format-group {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius);
}

.format-group label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.input-with-copy {
    display: flex;
    gap: 0.5rem;
}

.input-with-copy input {
    flex: 1;
}

.copy-btn {
    background: var(--primary);
    color: white;
    padding: 0 1rem;
    border-radius: var(--radius);
    white-space: nowrap;
    font-size: 0.8125rem;
}

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

.rgb-inputs,
.hsl-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.color-info {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1.5rem;
}

.color-info h3 {
    font-size: 0.9375rem;
    margin-bottom: 0.75rem;
}

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

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.625rem;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.25s ease;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Footer */
footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 1.75rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 3rem;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .tool-content {
        padding: 1.25rem;
    }
    
    .tool-info {
        padding: 1.25rem;
    }
    
    .color-preview-section {
        flex-direction: column;
    }
    
    #color-picker {
        width: 100%;
        height: 100px;
    }
    
    .rgb-inputs,
    .hsl-inputs {
        grid-template-columns: 1fr;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}
