:root {
    --primary-color: #007bff;
    --background-color: #f0f2f5;
    --text-color: #333;
    --wait-color: #e74c3c;
    --go-color: #e74c3c;
    --white-color: #fff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --circle-size: 250px;
    --mistake-color: #e74c3c;
}
*, *::before, *::after { box-sizing: border-box; }
body, html { margin: 0; padding: 0; width: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background-color: #f0f2f5; }
body { min-height: 100vh; display: grid; place-items: center; padding: 20px; text-align: center; }
#app-container { max-width: 600px; width: 100%; padding: 20px; background: var(--white-color); color: var(--text-color); border-radius: 12px; box-shadow: 0 4px 20px var(--shadow-color); display: flex; flex-direction: column; align-items: center; gap: 15px; }
#message-area, #circle-area, #result-area, #settings { width: 100%; }
#circle-area { min-height: 300px; display: flex; justify-content: center; align-items: center; border-radius: 8px; background-color: var(--background-color); transition: background-color 0.3s ease; padding: 20px; cursor: pointer; border: 4px solid transparent; transition: border-color 0.2s; }
#circle { width: var(--circle-size); height: var(--circle-size); border-radius: 50%; color: var(--white-color); display: flex; justify-content: center; align-items: center; font-size: 1.8rem; font-weight: bold; cursor: pointer; transition: all 0.2s ease; flex-shrink: 0; }
#circle:hover { opacity: 0.9; }
#circle:active { transform: scale(0.95); }
#circle.initial { background-color: var(--go-color); }
#circle.waiting { background-color: var(--go-color); }
#circle.go { background-color: var(--go-color); }
#circle-area.mistake { border-color: var(--mistake-color); }
#circle-area.shake { animation: shake 0.4s ease-in-out; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}
#result-area { display: flex; flex-direction: column; align-items: center; gap: 15px; }
#rank-display:not(:empty), #average-text, #chart-container, #action-area { width: 100%; max-width: 100%; }
#rank-display:not(:empty) { padding: 10px; border: 2px dashed var(--primary-color); border-radius: 8px; }
#rank-display .rank-title { margin: 0; font-size: 1rem; color: #666; }
#rank-display .rank-name { margin: 5px 0; font-size: 2rem; font-weight: bold; color: var(--primary-color); }
#rank-display .rank-comment { margin: 0; font-size: 0.9rem; }
#average-text { font-size: 1.4rem; font-weight: bold; color: var(--primary-color); }
#chart-container { width: 100%; position: relative; }
.chart-controls { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 10px; }
.chart-controls button { font-weight: bold; font-size: 1rem; width: 36px; height: 36px; padding: 0; line-height: 36px; border-radius: 50%; }
#reset-zoom-button { width: auto; padding: 8px 16px; height: 36px; line-height: normal; border-radius: 8px; font-size: 0.9rem; }
#action-area { padding-top: 15px; border-top: 1px solid #eee; }
#action-area p { margin: 0 0 15px 0; }
#settings { margin-top: 10px; border: 1px solid #ddd; border-radius: 8px; padding: 0 15px; }
#settings summary { font-weight: bold; cursor: pointer; padding: 10px 0; display: flex; justify-content: space-between; align-items: center; list-style: none; }
#settings summary::-webkit-details-marker { display: none; }
#settings[open] > #controls { padding: 15px 0; border-top: 1px solid #ddd; }
.disclosure-arrow { transition: transform 0.2s; }
#settings[open] .disclosure-arrow { transform: rotate(90deg); }
.control-group { margin-bottom: 15px; text-align: left; }
.control-group:last-child { margin-bottom: 0; }
.control-group label { display: block; margin-bottom: 5px; }
input[type="color"], input[type="range"], select { width: 100%; font-size: 1rem; padding: 5px; }
select { padding: 8px 5px; border: 1px solid #ccc; border-radius: 4px; }
#color-palettes { display: flex; gap: 10px; flex-wrap: wrap; }
.palette-button { flex-grow: 1; background-color: #f0f0f0; border: 1px solid #ccc; color: #333; padding: 8px 12px; font-weight: normal; }
#color-name-display { color: var(--go-color); font-weight: bold; }
.sub-instruction { font-size: 0.9rem; color: #666; margin-top: 5px; }
.button-group { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
button { background-color: var(--primary-color); color: var(--white-color); border: none; padding: 12px 20px; border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: bold; transition: background-color 0.2s, transform 0.1s; margin: 0; }
button:hover { opacity: 0.9; }
button:active { transform: scale(0.98); }
.text-button { background: none; border: none; color: var(--primary-color); padding: 5px; text-decoration: underline; }
#copy-button { background-color: #6c757d; }
#retry-button { background-color: #28a745; }
footer { padding: 20px 0 10px 0; width: 100%; text-align: center; font-size: 0.9rem; color: #888; }
.hidden { display: none !important; }