:root {
    /* Colors */
    --primary-color: #0d9488;
    /* Teal 600 */
    --primary-hover: #0f766e;
    /* Teal 700 */
    --bg-color: #f8fafc;
    /* Slate 50 */
    --card-bg: #ffffff;
    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --border-color: #e2e8f0;

    /* Spacing */
    --container-width: 800px;
    --spacing-md: 1.5rem;
    --spacing-lg: 3rem;
    --radius-md: 12px;
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
}

/* Accessibility utilities */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Improved focus styles for accessibility */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.site-header {
    background: var(--card-bg);
    padding: 2rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-lg);
}

.header-banner {
    max-width: 800px;
    margin: 0 auto;
}

.header-banner img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.visual-placeholder {
    width: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: transparent;
}

/* Calculator Section */
.calculator-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.input-wrapper {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

input[type="number"] {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.2rem;
    width: 120px;
    text-align: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

input[type="number"][aria-invalid="true"] {
    border-color: #ef4444;
    animation: shake 0.3s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--primary-hover);
}

/* Body Type Selector */
.body-type-selector {
    margin-top: 1.5rem;
    text-align: center;
    border: none;
    padding: 0;
}

.selector-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.radio-group {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.radio-group label {
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-main);
}

.radio-group input[type="radio"] {
    accent-color: var(--primary-color);
    width: 1.2em;
    height: 1.2em;
}

/* Result Section */
.result-section {
    margin-bottom: var(--spacing-lg);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.metric-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: 0 2px 4px rgb(0 0 0 / 0.05);
    border: 1px solid var(--border-color);
}

.metric-card h3 {
    margin: 0.5rem 0;
    font-size: 1rem;
    color: var(--text-muted);
}

.metric-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.hidden {
    display: none;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4rem;
}

/* AdSense Containers */
/* AdSense Containers (Production Style) */
.ad-container {
    background: transparent;
    /* Changed from gray */
    padding: 1rem 0;
    margin: 2rem auto;
    max-width: 100%;
    text-align: center;
    position: relative;
    min-height: 100px;
    /* Reserve space to prevent layout shift */
    border: none;
    /* Remove placeholder border */
}

/* Label remains for disclosure */
.ad-label {
    position: absolute;
    top: -10px;
    right: 50%;
    transform: translateX(50%);
    font-size: 10px;
    color: #cbd5e1;
    background: #fff;
    padding: 0 5px;
}

.ad-placeholder {
    /* Keep placeholder text for now, but style it subtly */
    color: #cbd5e1;
    font-size: 0.8rem;
    padding: 2rem 0;
    background: #f8fafc;
    border-radius: 4px;
}

/* Amazon Recommendations */
.recommendations {
    margin-top: 3rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.recommendations h3 {
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    /* Slightly wider cards */
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.product-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    border-color: var(--primary-color);
}

.product-img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    background: #fff;
    margin-bottom: 0.5rem;
}

.product-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0.5rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
    /* Push CTA down */
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #b12704;
    /* Amazon Price Red */
    margin-bottom: 0.5rem;
}

.product-price small {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.product-cta {
    display: block;
    width: 100%;
    margin-top: auto;
    /* Push to bottom of card */
    padding: 0.8rem;
    background: #FF9900;
    /* Amazon Standard CTA Orange */
    color: white;
    text-align: center;
    font-weight: 700;
    text-decoration: none;
    border-radius: 4px;
    /* Standard Amazon rounding */
    transition: background 0.2s;
    font-size: 0.95rem;
    /* Ensure box-sizing handles padding correctly to avoid overflow */
    box-sizing: border-box;
}

.product-cta:hover {
    background: #e68a00;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* Toast and Loading Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}