:root {
    /* Refined Color Palette - Agency Professional (Corporate Theme) */
    --color-main: #002b5b;        /* Deep Blue - Professional */
    --color-primary: #f8b400;     /* Amber - Reliable accent */
    --color-primary-hover: #e0a200;
    --color-secondary: #64748b;    /* Slate 500 - Neutral secondary */
    --color-text: #1e293b;        /* Slate 800 - Clear body text */
    --color-text-light: #64748b;   /* Slate 500 - Metadata/Labels */
    --color-bg: #f4f7f6;          /* Light grayish cyan - Fresh background */
    --color-card-bg: #ffffff;
    --color-border: #e2e8f0;      /* Slate 200 - Precise borders */
    --color-input-focus: #fde68a;  /* Amber 200 - Soft focus ring */
    
    /* Semantic Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* Typography */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-display: 'Outfit', sans-serif;

    /* Elevation & Depth */
    --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);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-premium: 0 20px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.05);

    /* Breakpoints */
    --bp-xl: 1200px;

    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: var(--bp-xl);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

main {
    flex: 1;
    padding: var(--spacing-xl) 0;
}

/* Header & Navigation */
header {
    background-color: var(--color-card-bg);
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-sm) 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

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

.site-title {
    font-family: var(--font-family-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-main);
}

.site-title a {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-logo-img {
    height: 36px;
    width: auto;
    display: block;
}

.logo-icon {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--color-primary), #818cf8);
    border-radius: 6px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-category {
    position: relative;
    padding: 10px 0;
}

.nav-category > a {
    text-decoration: none;
    color: var(--color-text-light);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-category > a::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    opacity: 0.5;
    transition: transform 0.2s;
}

.nav-category:hover > a {
    color: var(--color-primary);
    background-color: #f1f5f9;
}

.nav-category:hover > a::after {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1000;
    display: grid;
    gap: 4px;
}

.nav-category:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-item {
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.8rem;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    display: block;
    transition: all 0.2s;
    white-space: nowrap;
}

.dropdown-item:hover {
    background-color: #f8fafc;
    color: var(--color-primary);
    padding-left: 18px;
}

.dropdown-item.active {
    background-color: #eef2ff;
    color: var(--color-primary);
    font-weight: 700;
}

@media (max-width: 900px) {
    nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .nav-category {
        padding: 0;
    }
    .nav-category > a::after {
        display: none;
    }
    .dropdown-menu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        border: none;
        padding: 0 0 0 16px;
        background: transparent;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s;
    }
    .nav-category:hover .dropdown-menu {
        max-height: 500px;
        transform: none;
    }
}


/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--color-main);
    z-index: 10;
}

@media (max-width: 900px) {
    .menu-toggle {
        display: block;
    }

    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: var(--color-card-bg);
        border-left: 1px solid var(--color-border);
        box-shadow: -10px 0 30px rgba(0,0,0,0.1);
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 5;
        padding: 80px var(--spacing-md) var(--spacing-md);
    }

    nav.is-open {
        right: 0;
    }

    nav ul {
        flex-direction: column;
        gap: 12px;
    }

    nav a {
        display: block;
        padding: 12px 16px;
        font-size: 1.1rem;
        border-radius: var(--radius-lg);
    }
    
    /* Backdrop */
    .menu-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(4px);
        z-index: 900;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }
    
    .menu-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }
}

/* Tool Page Components */
.tool-container {
    animation: fadeIn 0.4s ease-out forwards;
}

.tool-header {
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.tool-header h1 {
    font-family: var(--font-family-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-main);
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.02em;
}

.tool-header p {
    color: var(--color-text-light);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Cards & Layout */
.input-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-md);
}

.input-card h2 {
    font-family: var(--font-family-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--color-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.calc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

@media (min-width: 768px) {
    .calc-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Result Display */
.result-area {
    background: #f1f5f9; /* Slate 100 */
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    text-align: center;
    border: 1px solid var(--color-border);
}

.result-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-light);
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-xs);
}

.result-value {
    font-family: var(--font-family-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-text);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--color-text);
    background-color: #fff;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
    gap: 8px;
}

.btn-primary, .btn:not(.btn-outline):not(.btn-icon) {
    background-color: var(--color-primary);
    color: #fff;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover, .btn:not(.btn-outline):not(.btn-icon):hover {
    background-color: var(--color-primary-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover {
    background-color: #f1f5f9;
    border-color: var(--color-secondary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
}

/* Info Tips */
.info-tip {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-md);
    background-color: #eff6ff; /* Blue 50 */
    border-left: 4px solid var(--color-info);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: #1e40af; /* Blue 800 */
}

/* Footer */
.site-footer {
    background-color: #002b5b;
    border-top: none;
    padding: var(--spacing-xl) 0 var(--spacing-lg);
    color: rgba(255, 255, 255, 0.7);
    margin-top: var(--spacing-xl);
}

.site-footer a {
    transition: all 0.2s;
}

.site-footer a:hover {
    color: var(--color-primary) !important;
    opacity: 1 !important;
    padding-left: 4px;
}

/* Footer Components */
.footer-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    text-align: left;
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.1);
}

.footer-logo-wrapper {
    margin-bottom: 16px;
    opacity: 0.9;
}

.footer-logo-link {
    display: flex;
    align-items: center;
}

.footer-logo-img {
    height: 36px;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);
}

.footer-col-heading {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
    color: var(--color-primary);
}

.footer-link-list {
    list-style: none;
    font-size: 0.8rem;
}

.footer-link-list li {
    margin-bottom: 8px;
}

.footer-link-list a {
    text-decoration: none;
    color: inherit;
    opacity: 0.6;
    transition: all 0.2s;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.4;
    font-size: 0.7rem;
}

.footer-bottom-links {
    display: flex;
    gap: 16px;
}

.footer-bottom-links a {
    text-decoration: none;
    color: inherit;
}

@media (max-width: 768px) {
    .site-footer {
        text-align: center;
    }
    .site-footer .footer-grid {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-lg) !important;
    }
}


/* Animations */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--color-main);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* Unified Guide Card */
.guide-card {
    background-color: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-card-bg);
    border-radius: var(--radius-xl);
    padding: var(--spacing-md);
    margin: var(--spacing-lg) 0 var(--spacing-xl);
    box-shadow: var(--shadow-sm);
}

.guide-header {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: var(--spacing-sm);
}

.guide-badge {
    padding: 2px 8px;
    background-color: var(--color-primary);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.guide-header h2, .guide-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.guide-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.guide-item {
    padding: var(--spacing-sm) 0;
    text-align: left;
}

.guide-item:not(:last-child) {
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.guide-item-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.guide-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.guide-item-title span {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-main);
}

.guide-item p {
    font-size: 0.7rem;
    color: var(--color-text-light);
    line-height: 1.5;
    margin: 0;
}

@media (min-width: 768px) {
    .guide-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .guide-item {
        padding: 0 var(--spacing-md);
        border-bottom: none !important;
    }
    
    .guide-item:not(:last-child) {
        border-right: 1px solid rgba(226, 232, 240, 0.5);
    }
}

/* Utilities */
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-8 { margin-top: 32px; }

.flex-row { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.text-center { text-align: center; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--color-text-light); }
.text-slate-400 { color: #94a3b8; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }

.bg-error { background-color: var(--color-error); }
.bg-primary { background-color: var(--color-primary); }
.bg-success { background-color: var(--color-success); }
.bg-info { background-color: var(--color-info); }

/* Common UI Components */
.password-display {
    font-family: monospace;
    font-size: 1.4rem;
    letter-spacing: 0.1em;
    color: var(--color-main);
}

.kana-display {
    background: #f8fafc;
    min-height: 42px;
    display: flex;
    align-items: center;
    color: var(--color-text-light);
    word-break: break-all;
    flex: 1;
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-lg {
    width: 18px;
    height: 18px;
}

.range-slider {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
    margin: 12px 0;
}

.btn-lg {
    padding: 12px 48px;
    font-size: 1.1rem;
}

.btn-rounded {
    border-radius: 30px;
}

.btn-pink {
    background-color: #ec4899;
    color: #fff;
}
.btn-pink:hover {
    background-color: #db2777;
    color: #fff;
}

.tool-divider-line {
    height: 1px;
    background: #e2e8f0;
    margin: 48px 0;
    position: relative;
}

.tool-divider-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 0 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.tool-divider-dashed {
    border: none;
    border-top: 1px dashed var(--color-border);
    margin: 30px 0;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255,255,255,0.1);
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: #cbd5e1;
}

.hero-link {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 4px;
    font-weight: 500;
}

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

.section-heading {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
}

.section-subheading {
    font-size: 0.85rem;
    color: #64748b;
}

