/* styles.css - 九九練習アプリのスタイル */
/* Author: chiilabo (https://chiilabo.jp) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* タップ時のズームを無効化 */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    --color-border: #ddd;
    --color-background: #f2fbf4;
    --color-primary: #333;
    --color-accent: #2ecc71;
    --color-accent-light: #dff6e8;
}

body {
    font-family: 'Arial', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    background-color: var(--color-background);
    height: calc(100vh - 144px);
}

.header {
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    min-height: 72px;
    width: 100%;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}
.footer {
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    min-height: 72px;
    width: 100%;   
}
.app-icon {
    width: 48px;
    height: 48px;
    background-image: url(icons/icon-128.png);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 12px;
    border: #ccc 1px solid;
}
.header-back-button {
    background: white;
    border: 2px solid var(--color-accent);
    color: var(--color-primary);
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.header-back-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.header-back-button.hidden {
    opacity: 0;
    pointer-events: none;
}
.problem-count {
    font-size: 24px;
    font-weight: bold;

    color: #666;
}
.header-buttons {
    display: flex
;
    gap: 8px;
    margin-right: 10px;
}
.header-buttons button {
    background: transparent;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex
;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.header-help-button svg {
    width: 32px;
    height: 32px;
}
.header-buttons button.install-button {
    background: unset;
    width: 36px;
    height: 36px;
    background-image: url(icons/icon-128.png);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

#game-screen {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100%;
}

.selection-screen {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 10px 0;
}

.selection-title {
    font-size: 22px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.selection-group {
    background: white;
    border-radius: 14px;
    padding: 12px;
    margin: 8px 0;
}

.selection-label {
    font-size: 16px;
    font-weight: bold;
    color: #666;
    margin-bottom: 10px;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.selection-grid.order-grid {
    grid-template-columns: repeat(3, 1fr);
}

.selection-btn {
    background: #fff;
    border: 2px solid var(--color-accent);
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    padding: 10px 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
}

.selection-btn.wide {
    width: 100%;
    padding: 12px 0;
}

.selection-btn.selected {
    background: var(--color-accent-light);
    color: #222;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.selection-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.problem-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    height: 110px;
}
.problem-line {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}
.problem {
    font-size: 36px;
    font-weight: bold;
    color: #333;
    margin: auto 10px;
    display: inline-block;
}

.input-section {
    margin-left: 15px;
    display: inline-block;
    justify-content: space-between;
    align-items: center;
    height: 66px;
}

.answer-display {
    background: white;
    border: 3px solid var(--color-accent);
    border-radius: 10px;
    padding: 10px;
    font-size: 36px;
    font-weight: bold;
    color: #333;
    min-width: 80px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dots-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 15px;
    height: 60px;
}

.dots-group {
    display: grid;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 1px;
}

.dot.blue { 
    background-color: #3498db; 
}

.dot.green { 
    background-color: #2ecc71; 
}

.dot.yellow {
    background-color: #f1c40f;
}


.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
    justify-items: center;
    align-items: center;    
}

.key-btn {
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 10px;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    /* タップ時の動作を最適化 */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.key-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

/* 数字ボタンの色 */
.num-btn {
    background: #fff;
    color: #333;
    border: 2px solid var(--color-accent);
}

/* 特殊ボタンの色 */
.clear-btn {
    background: #dc3545;
    color: white;
    font-size: 24px;
    border-radius: 35px;
}

.enter-btn {
    background: #007bff;
    color: white;
    font-size: 24px;
    border-radius: 35px;
}

.clear-btn svg, .enter-btn svg {
    height: 60%;
    fill: white;
}
.zero-btn {
    background: #fff;
    color: #333;
    border: 2px solid var(--color-accent);
}

.celebration {
    display: none;
}

.celebration.show {
    display: block;
    animation: bounce 0.6s ease-in-out;
}

.sticker-container {
    display: none;
    text-align: center;
}

.sticker-container.show {
    display: block;
    animation: fadeIn 1s ease-in-out;
}
.sticker-trophy {
    font-size: 120px;
    margin: 20px 0;
}
.sticker {
    font-size: 60px;
    margin: 20px 0;
}

.message {
    font-size: 24px;
    color: #333;
    font-weight: bold;
    margin: 20px 0;
}

.restart-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s;
}

.restart-btn:hover {
    transform: translateY(-2px);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { 
        transform: translateY(0); 
    }
    40% { 
        transform: translateY(-10px); 
    }
    60% { 
        transform: translateY(-5px); 
    }
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.8); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

.feedback {
    font-size: 24px;
    font-weight: bold;
    margin: 15px;
    min-height: 40px;
}

.correct {
    color: #00b894;
}

.incorrect {
    color: #d63031;
}
