/* Reset & Base */
:root {
    --bg-color: #121212;
    --bg-dark: #0e0e0e;
    --card-bg: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent-color: #a78bfa;
    /* Soft Purple */
    --accent-hover: #8b5cf6;
    /* Deeper Purple */
    --card-border: #333333;
    --transition-speed: 0.3s;
}

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

/* Utility */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

body {
    font-family: 'Zen Maru Gothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Background Animation (Subtle Gradient Pulse) */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, #1a1a1a 0%, #0d0d0d 100%);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.site-header {
    padding: 20px 0 10px;
    margin-bottom: 12px;
    animation: fadeInDown 0.8s ease-out;
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 400;
}

/* Grid Layout */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding-bottom: 60px;
    animation: fadeInUp 1s ease-out;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 25px;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all var(--transition-speed) cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    background: rgba(30, 30, 30, 0.6);
    /* Glassmorphismish */
}

/* Glow Effect on Hover */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.1), transparent);
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(167, 139, 250, 0.2);
}

.card:hover::before {
    opacity: 1;
}

.card-icon {
    font-size: 2rem;
    color: var(--accent-color);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(167, 139, 250, 0.1);
    border-radius: 12px;
    transition: transform var(--transition-speed);
}

.card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
    background: var(--accent-color);
    color: #fff;
}

.card-content {
    flex: 1;
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 5px;
    font-weight: 700;
}

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

.card-arrow {
    color: var(--text-secondary);
    font-size: 1rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: all var(--transition-speed);
}

.card:hover .card-arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--accent-color);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-top: 1px solid var(--card-border);
    margin-top: auto;
}

.kofi-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.3);
    color: var(--accent-color);
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.75rem;
    margin-bottom: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.kofi-link:hover {
    background: var(--accent-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(167, 139, 250, 0.3);
}

.kofi-link i {
    font-size: 1rem;
}

/* Tool Content Styles */
.content-card {
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    animation: fadeInUp 0.8s ease-out;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-left: 5px solid var(--accent-color);
    padding-left: 15px;
}

.description-text {
    color: var(--text-secondary);
    margin-bottom: 30px;
    white-space: pre-line;
}

/* Form Elements */
.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.styled-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

.styled-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.3);
}

.input-container {
    background: rgba(167, 139, 250, 0.05);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(30, 30, 30, 0.4);
}

.styled-table th {
    background: var(--accent-color);
    color: #fff;
    padding: 12px;
    text-align: center;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.styled-table td {
    padding: 12px;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.9rem;
}

.styled-table tr:last-child td {
    border-bottom: none;
}

.styled-table tr:hover {
    background: rgba(167, 139, 250, 0.1);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.font-bold {
    font-weight: 700;
}

/* Buttons */
.btn-back {
    display: inline-block;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.9rem;
    margin-top: 20px;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Tabs */
.tab-container {
    display: flex;
    border-bottom: 2px solid var(--card-border);
    margin-bottom: 30px;
    gap: 10px;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(167, 139, 250, 0.05);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    background: rgba(167, 139, 250, 0.1);
}

.tab-content {
    display: block;
}

.tab-content.hidden {
    display: none;
}

/* Info Box */
.info-box {
    background: rgba(167, 139, 250, 0.1);
    border-left: 4px solid var(--accent-color);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    animation: fadeIn 0.5s ease-out;
}

.info-box.hidden {
    display: none;
}

.info-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-color);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Modal / Error Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.overlay.hidden {
    display: none;
}

.modal {
    background: var(--card-bg);
    border: 1px solid #ef4444;
    padding: 30px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal h3 {
    color: #ef4444;
    margin-bottom: 15px;
}

.btn-close {
    margin-top: 20px;
    padding: 10px 20px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Tweaks */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .site-header {
        padding: 12px 0 6px;
        margin-bottom: 8px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .content-card {
        padding: 14px;
        border-radius: 12px;
        margin-bottom: 12px;
    }

    .grid-container {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 12px;
        padding-bottom: 30px;
    }

    .card {
        padding: 15px;
    }

    .section-title {
        font-size: 1.2rem;
    }
}

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

/* Simple Keyframe Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Compare Features */
.compare-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--accent-color);
    z-index: 5;
    background-color: rgba(0,0,0,0.5);
    border-radius: 4px;
}

body:not(.compare-mode-active) .compare-checkbox {
    display: none !important;
}

.compare-float-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 10px 25px rgba(167, 139, 250, 0.4);
    cursor: pointer;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.compare-float-btn:hover {
    background: var(--accent-hover);
    transform: translateX(-50%) translateY(-3px);
}

.compare-float-btn.hidden {
    display: none !important;
    pointer-events: none;
}

.compare-float-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--card-border);
    box-shadow: none;
    color: var(--text-secondary);
}

/* 比較用モーダルのチャートコンテナ */
.compare-chart-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 15px;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 500px;
    margin: 0 auto;
    position: relative;
    box-sizing: border-box;
}