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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1)
}

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

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

header {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 1.5rem;
    transition: color 0.3s
}

nav a:hover {
    color: var(--primary-color)
}

main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px)
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem
}

.tool-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
    display: block
}

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

.tool-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: white;
    font-size: 1.5rem
}

.tool-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary)
}

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

.tool-page {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-md)
}

.tool-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color)
}

.tool-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem
}

.tool-header p {
    color: var(--text-secondary)
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary)
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1)
}

textarea.form-control {
    min-height: 200px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    resize: vertical
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem
}

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

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

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

.btn-secondary:hover {
    background: #475569
}

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

.btn-success:hover {
    background: #16a34a
}

.btn-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem
}

.result-box {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px solid var(--border-color)
}

.result-box h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem
}

.result-content {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem
}

.result-box {
    position: relative
}

.error-message {
    color: var(--error-color);
    padding: 0.75rem;
    background: #fef2f2;
    border-radius: 6px;
    margin-top: 1rem;
    display: none
}

.error-message.show {
    display: block
}

.success-message {
    color: var(--success-color);
    padding: 0.75rem;
    background: #f0fdf4;
    border-radius: 6px;
    margin-top: 1rem;
    display: none
}

.success-message.show {
    display: block
}

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

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

.stat-card .label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color)
}

.calculator {
    max-width: 400px;
    margin: 0 auto
}

.calc-display {
    background: #1e293b;
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: right;
    font-size: 2rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: flex-end
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem
}

.calc-btn {
    padding: 1.25rem;
    font-size: 1.25rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm)
}

.calc-btn:hover {
    background: #f1f5f9
}

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

.calc-btn.operator:hover {
    background: var(--primary-hover)
}

.calc-btn.equals {
    background: var(--success-color);
    color: white
}

.calc-btn.equals:hover {
    background: #16a34a
}

.calc-btn.clear {
    background: var(--error-color);
    color: white
}

.calc-btn.clear:hover {
    background: #dc2626
}

footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem
}

.footer-content {
    text-align: center;
    color: var(--text-secondary)
}

.breadcrumb {
    margin-bottom: 1.5rem;
    font-size: 0.875rem
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none
}

.breadcrumb a:hover {
    text-decoration: underline
}

.breadcrumb span {
    color: var(--text-secondary)
}

@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: 1fr
    }
    
    .tool-header h1 {
        font-size: 1.5rem
    }
    
    .btn-group {
        flex-direction: column
    }
    
    .btn {
        width: 100%
    }
    
    .calc-buttons {
        gap: 0.25rem
    }
    
    .calc-btn {
        padding: 1rem;
        font-size: 1rem
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 1rem
    }
    
    nav a {
        margin: 0 0.75rem
    }
    
    .tool-page {
        padding: 1rem
    }
}