* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hiragino Kaku Gothic Pro', 'Meiryo', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.site-header {
    background: #1a1a2e;
    color: white;
    padding: 10px 0;
    width: 100%;
}

.site-header a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    font-weight: bold;
    color: white;
    text-decoration: none;
    font-size: 1.1em;
}

.site-header img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.page-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2em;
}

.info {
    margin-bottom: 30px;
    font-size: 1.2em;
    color: #555;
}

.level-info {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 20px;
}

.timer {
    font-size: 1.3em;
    color: #764ba2;
    margin-bottom: 20px;
    font-weight: bold;
}

#grid {
    display: inline-grid;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.cell {
    background: #f0f0f0;
    border: 3px solid #ddd;
    border-radius: 10px;
    font-size: 3em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}

.cell:hover {
    background: #e0e0e0;
    transform: scale(1.05);
    border-color: #667eea;
}

.cell:active {
    transform: scale(0.95);
}

.start-button, .restart-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.3em;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.start-button:hover, .restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.start-button:active, .restart-button:active {
    transform: translateY(0);
}

.reset-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 25px;
    font-size: 1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    display: block;
    margin: 30px auto 0;
}

.reset-button:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.reset-button:active {
    transform: translateY(0);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.3s;
}

.result {
    margin-top: 30px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 15px;
    display: none;
}

.result.show {
    display: block;
}

.result h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2em;
}

.result-time {
    font-size: 3em;
    font-weight: bold;
    color: #764ba2;
    margin: 20px 0;
}

.badge {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.5em;
    font-weight: bold;
    margin: 20px 0;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.5);
    animation: badgePulse 1.5s infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* 月のスタイル */
.moon {
    position: fixed;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, #f0e68c 40%, #daa520 100%);
    box-shadow: 0 0 40px rgba(255, 255, 200, 0.8), 0 0 80px rgba(255, 255, 200, 0.4);
    top: 15%;
    right: 15%;
    z-index: 10;
    pointer-events: none;
    animation: moonGlow 3s ease-in-out infinite;
    overflow: hidden;
}

.moon-shadow {
    pointer-events: none;
}

@keyframes moonGlow {
    0%, 100% { 
        box-shadow: 0 0 40px rgba(255, 255, 200, 0.8), 0 0 80px rgba(255, 255, 200, 0.4);
    }
    50% { 
        box-shadow: 0 0 50px rgba(255, 255, 200, 1), 0 0 100px rgba(255, 255, 200, 0.6);
    }
}

.page-wrapper {
    position: relative;
}

.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
}

.level-times {
    text-align: left;
    margin: 20px auto;
    display: inline-block;
    width: 100%;
    max-width: 400px;
}

.level-time {
    font-size: 1.2em;
    margin: 10px 0;
    color: #555;
}

.restart-button {
    display: block;
    margin: 30px auto 0;
}

.instructions {
    background: #fff9e6;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 5px solid #ffd700;
}

.instructions p {
    margin: 10px 0;
    color: #666;
    font-size: 1.1em;
}

.char-selection {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 30px 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.char-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
}

.char-description {
    font-size: 0.75em;
    color: #666;
    text-align: center;
    min-height: 2em;
    line-height: 1.3;
    max-width: 120px;
}

.difficulty-section {
    margin: 20px 0;
}

.difficulty-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.difficulty-title.easy {
    color: #4CAF50;
}

.difficulty-title.normal {
    color: #FF9800;
}

.difficulty-title.hard {
    color: #f44336;
}

.difficulty-title.veryhard {
    color: #9c27b0;
}

.char-button {
    background: white;
    border: 3px solid #667eea;
    padding: 20px;
    font-size: 1.8em;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    color: #333;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.char-button:hover {
    background: #667eea;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.char-button:active {
    transform: translateY(0);
}

.best-time {
    font-size: 0.5em;
    color: #666;
    font-weight: normal;
    margin-top: 5px;
}

.char-button:hover .best-time {
    color: white;
}

.char-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.5);
    animation: badgePulse 1.5s infinite;
}

.compare-mode {
    background: #f0f8ff;
    padding: 30px;
    border-radius: 15px;
    margin-top: 30px;
    border: 3px solid #667eea;
}

.compare-mode h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.compare-mode h3:hover {
    color: #5568d3;
}

.compare-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.compare-content.open {
    max-height: 1000px;
}

.toggle-icon {
    transition: transform 0.3s;
}

.toggle-icon.open {
    transform: rotate(180deg);
}

.compare-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.char-display {
    position: relative;
    width: 150px;
    height: 150px;
    background: white;
    border: 3px solid #ddd;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 5em;
    font-weight: bold;
}

.overlay-container {
    position: relative;
    width: 150px;
    height: 150px;
    transition: all 0.3s ease;
}

.overlay-container:hover {
    transform: scale(4);
    z-index: 100;
}

.overlay-char {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 5em;
    font-weight: bold;
    border: 3px solid #ddd;
    border-radius: 15px;
    background: white;
}

.overlay-char:nth-child(1) {
    color: #0000ff;
}

.overlay-char:nth-child(2) {
    opacity: 0.5;
    color: #ff0000;
}

.compare-select {
    padding: 10px 20px;
    font-size: 1.1em;
    border: 2px solid #667eea;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    margin: 10px;
}

.opacity-slider {
    width: 200px;
    margin: 20px 0;
}

.slider-label {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 10px;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.5em;
    }
    
    .cell {
        font-size: 2em;
    }

    .char-selection {
        grid-template-columns: repeat(2, 1fr);
    }

    .char-button {
        font-size: 1.5em;
        padding: 15px;
    }

    .compare-container {
        flex-direction: column;
        gap: 15px;
    }

    .char-display, .overlay-container {
        width: 120px;
        height: 120px;
        font-size: 4em;
    }

    .overlay-char {
        font-size: 4em;
    }
}

.clear-data-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 20px;
    font-size: 0.9em;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 30px;
    opacity: 0.7;
}

.clear-data-button:hover {
    opacity: 1;
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(220, 53, 69, 0.3);
}

.clear-data-button:active {
    transform: translateY(0);
}
