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

:root {
    --bg-primary: hsl(210, 30%, 8%);
    --bg-card: hsl(210, 25%, 12%);
    --bg-muted: hsl(200, 10%, 20%);
    --text-primary: hsl(120, 5%, 95%);
    --text-muted: hsl(120, 5%, 70%);
    --primary: hsl(142, 70%, 45%);
    --primary-dark: hsl(142, 70%, 35%);
    --accent: hsl(200, 60%, 50%);
    --border: hsl(200, 15%, 20%);
    --shadow: rgba(0, 0, 0, 0.3);
}

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

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

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.icon-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
}

.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.title {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 42rem;
    margin: 0 auto;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 72rem;
    margin: 0 auto;
}

.tool-card {
    background-color: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    cursor: pointer;
    display: block;
}

.tool-card:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 40px var(--shadow);
    border-color: var(--primary);
}

.tool-icon {
    width: 64px;
    height: 64px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--bg-primary);
    transition: all 0.3s ease;
}

.tool-card:hover .tool-icon {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.3); }
    50% { box-shadow: 0 0 30px rgba(76, 175, 80, 0.6); }
}

.gradient-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.tool-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.tool-card:hover .tool-title {
    color: var(--primary);
}

.tool-description {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.tool-link {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.875rem;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 4rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Back Button */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: transparent;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
}

.back-button:hover {
    background-color: var(--bg-card);
    border-color: var(--primary);
}

/* Converter Styles */
.converter-header {
    margin-bottom: 2rem;
}

.converter-card {
    background-color: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 56rem;
    margin: 0 auto;
}

.converter-header-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.converter-title {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.active-dimension {
    color: var(--primary);
}

.mode-description {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.mode-toggle-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: transparent;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.toggle-button:hover {
    background-color: var(--bg-muted);
    border-color: var(--primary);
}

.converter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .converter-grid {
        grid-template-columns: 1fr;
    }
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.accent-title {
    color: var(--accent);
}

.input-group, .output-group {
    margin-bottom: 1rem;
}

.input-group label, .output-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    background-color: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.output-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    padding: 0.75rem;
    background-color: var(--bg-muted);
    border-radius: 0.375rem;
    text-align: center;
}

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

.primary-button, .secondary-button {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.primary-button {
    background-color: var(--primary);
    color: var(--bg-primary);
}

.primary-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.secondary-button {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.secondary-button:hover {
    background-color: var(--bg-muted);
    border-color: var(--primary);
}

.info-box {
    padding: 1rem;
    background-color: var(--bg-muted);
    border-radius: 0.5rem;
}

.info-box p {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
}

.info-box strong {
    color: var(--text-primary);
}

