@charset "UTF-8";

/* Reset & Global */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --surface-color: rgba(255, 255, 255, 0.95);
    --bg-color: #f0f2f5;
    --text-color: #333;
    --accent-color: #764ba2;
    --success-color: #48bb78;
    --error-color: #f56565;
    --grid-size: 300px;
    --cell-size: calc(var(--grid-size) / 3 - 10px);
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--bg-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    color: var(--text-color);
    padding-top: 70px;
    overflow-x: hidden;
}

/* Header */
header {
    width: 100%;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.header-hidden {
    transform: translateY(-100%);
    box-shadow: none;
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

nav ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--accent-color);
}

.lang-switch {
    border: 1px solid #ddd;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    background: none;
    white-space: nowrap;
}

/* Mobile Header */
@media (max-width: 600px) {
    .header-inner {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
        padding: 0.5rem;
    }

    .logo {
        width: 100%;
        text-align: center;
        margin-bottom: 0.2rem;
    }

    nav ul {
        gap: 1rem;
        font-size: 0.9rem;
    }

    body {
        padding-top: 100px;
    }

    html {
        scroll-padding-top: 110px;
    }
}

/* Hero & Ads */
.hero {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    background: linear-gradient(to bottom, #f0f2f5, #fff);
}

.ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e2e8f0;
    color: #718096;
    margin: 10px 0;
    border-radius: 4px;
    overflow: hidden;
}

.ad-top { width: 728px; height: 90px; }
.ad-bottom { width: 336px; height: 280px; }

@media (max-width: 768px) {
    .ad-top { width: 320px; height: 50px; }
    .ad-bottom { width: 300px; height: 250px; }
    :root {
        --grid-size: 90vw;
        --cell-size: calc(var(--grid-size) / 3 - 6px);
    }
}

/* Contact Form */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #444;
}
.form-input, .form-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}
.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}
.form-textarea {
    resize: vertical;
    min-height: 150px;
}
.submit-btn {
    width: 100%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.submit-btn:hover {
    opacity: 0.9;
}

/* App Container */
#app {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    text-align: center;
    box-sizing: border-box;
    background: var(--surface-color);
    margin: 10px;
    position: relative;
    overflow: hidden;
}

h1 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

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

/* Start Screen */
.difficulty-selector {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
    justify-content: center;
}

.difficulty-radio { display: none; }

.difficulty-label {
    padding: 8px 16px;
    border: 2px solid #ddd;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.difficulty-radio:checked+.difficulty-label {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: scale(1.05);
}

button.primary-btn {
    background: var(--primary-gradient);
    border: none;
    color: white;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(118, 75, 162, 0.3);
}

button.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(118, 75, 162, 0.4);
}

button.primary-btn:active {
    transform: translateY(0);
}

/* Game Screen */
.stats-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-weight: bold;
    color: #555;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    width: var(--grid-size);
    height: var(--grid-size);
    background: #f8fafc;
    padding: 10px;
    border-radius: 12px;
    margin: 0 auto;
}

.grid-cell {
    background: #e2e8f0;
    border-radius: 8px;
    width: 100%;
    padding-bottom: 100%;
    position: relative;
    transition: background 0.2s;
}

.grid-cell.active {
    background: #764ba2;
    box-shadow: 0 0 15px rgba(118, 75, 162, 0.5);
    transform: scale(0.95);
}

.grid-cell.correct-flash { background: var(--success-color) !important; }
.grid-cell.wrong-flash { background: var(--error-color) !important; }

.controls { width: 100%; }

.match-btn {
    width: 100%;
    padding: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    background: white;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.1s;
    touch-action: manipulation;
}

.match-btn:active {
    background: var(--accent-color);
    color: white;
}

.feedback-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

/* Result Screen */
.score-display {
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent-color);
}

.score-detail {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1rem;
}

/* Sections & Blog */
.content-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 1rem;
    line-height: 1.8;
}

.content-section h2 {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 2rem;
    text-align: center;
}

.content-section h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #444;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}

/* Blog */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.blog-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    text-decoration: none;
    color: inherit;
}

.blog-card:hover { transform: translateY(-5px); }

.blog-img {
    height: 160px;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
}

.blog-content { padding: 1.5rem; }
.blog-title { font-weight: 700; margin-bottom: 0.5rem; display: block; }
.blog-date { font-size: 0.85rem; color: #888; }

/* Footer */
footer {
    background: #2d3748;
    color: white;
    padding: 3rem 1rem;
    margin-top: auto;
    width: 100%;
}

.footer-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.footer-logo {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: block;
}

.footer-links a {
    color: #a0aec0;
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
}

.footer-links a:hover { color: white; }

.copyright {
    text-align: center;
    color: #718096;
    margin-top: 3rem;
    font-size: 0.9rem;
}

/* Utility */
.hidden { display: none; }
.text-sm { font-size: 0.9rem; color: #666; }
