@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&family=M+PLUS+Rounded+1c:wght@400;700&display=swap');

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

:root {
    --primary-color: #FFD700;
    --secondary-color: #FFC107;
    --accent-color: #FF9800;
    --background-color: #FFFBF0;
    --card-color: #ffffff;
    --text-color: #4A4A4A;
    --success-color: #4CD964;
    --error-color: #FF3B30;
    --timer-color: #5AC8FA;
    --timer-bg: #FFF8E1;
}

body {
    font-family: 'M PLUS Rounded 1c', 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: linear-gradient(135deg, #FFF8DC 0%, #FFE082 100%);
}

.container {
    max-width: 600px;
    width: 100%;
    background-color: var(--card-color);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.2);
    text-align: center;
}

h1 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 26px;
    text-shadow: 1px 1px 2px rgba(255, 215, 0, 0.2);
}

.game-info {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 16px;
    background-color: rgba(255, 215, 0, 0.1);
    border: 2px dashed var(--secondary-color);
}

.game-info p {
    margin: 5px 0;
    font-size: 14px;
}

.game-info p:first-child {
    width: 100%;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-color);
}

.stats-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.stat-item {
    font-size: 14px;
    color: var(--text-color);
}

.stat {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    margin: 0 3px;
    min-width: 30px;
    box-shadow: 0 2px 5px rgba(255, 215, 0, 0.3);
}

.timer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

.timer-label {
    margin-right: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-color);
}

.timer-bar-container {
    flex-grow: 1;
    height: 14px;
    background-color: var(--timer-bg);
    border-radius: 10px;
    overflow: hidden;
    margin: 0 5px;
    max-width: 250px;
    border: 2px solid rgba(255, 215, 0, 0.2);
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #FFD700 0%, #FF9800 50%, #FF6F00 100%);
    border-radius: 6px;
    transition: width 1s linear;
}

.timer-text {
    font-size: 14px;
    font-weight: 500;
    margin-left: 5px;
    color: var(--primary-color);
}

#game-board {
    display: grid;
    margin: 0 auto 15px;
    gap: 5px;
    width: 100%;
    max-width: 350px;
    aspect-ratio: 1/1;
}

.tile {
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.tile:hover {
    transform: scale(0.95);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
}

.controls {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

button {
    background: linear-gradient(to bottom right, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
    min-width: 130px;
    letter-spacing: 0.5px;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(255, 215, 0, 0.4);
}

button:disabled {
    background: linear-gradient(to bottom right, #CCCCCC, #EEEEEE);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#result {
    margin-top: 15px;
    padding: 15px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 18px;
    animation: fadeIn 0.5s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
}

#result.success {
    background: linear-gradient(to right, var(--success-color), #A0FFA0);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

#result.failure {
    background: linear-gradient(to right, var(--error-color), #FFA0A0);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.hidden {
    display: none;
}

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.correct-tile {
    animation: pulse 0.5s ease;
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    #game-board {
        max-width: 280px;
    }
    
    h1 {
        font-size: 22px;
    }
    
    .controls button {
        padding: 10px 18px;
        font-size: 14px;
        min-width: 110px;
    }
    
    .timer-container {
        flex-direction: column;
        gap: 5px;
    }
    
    .timer-bar-container {
        width: 100%;
        max-width: 100%;
    }
}
/* オフライン表示 */
.offline-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #ff9800;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* インストールバナー */
.install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #4CAF50;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    max-width: 90%;
    animation: slideUp 0.3s ease-out;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.install-btn {
    background: white;
    color: #4CAF50;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.install-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.dismiss-btn {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* レスポンシブ対応の改善 */
@media (max-width: 480px) {
    .install-banner {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
    }
    
    .install-content {
        font-size: 12px;
        gap: 8px;
    }
    
    .install-content span {
        flex: 1;
    }
}
/* 新記録表示 */
.new-record {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #333;
    padding: 10px;
    border-radius: 10px;
    margin-top: 10px;
    font-weight: bold;
    text-align: center;
    animation: celebration 0.6s ease-in-out;
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.3);
}

@keyframes celebration {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* オフライン対応スタイル */
#offline-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #ff9800;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

#offline-indicator.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Font Awesomeが読み込めない場合のフォールバック（削除） */
/* 代わりにHTMLで直接絵文字アイコンを使用 */

/* 絵文字アイコンのスタイル */
.emoji-icon {
    margin-right: 0.5em;
    display: inline-block;
}
