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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #222;
    overflow: hidden;
}

.wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 30px 32px 20px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #111;
    letter-spacing: -0.5px;
}

.subtitle {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 28px;
    line-height: 1.5;
}

.green-text {
    color: #22c55e;
    font-weight: 600;
}

/* the game box */
.box {
    width: 100%;
    flex: 1;
    min-height: 120px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin-bottom: 20px;
    transition: background-color 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.box span {
    font-size: 1.15rem;
    font-weight: 500;
    pointer-events: none;
}

.box.idle {
    background: #e8e8e8;
    color: #999;
}

.box.waiting {
    background: #ef4444;
    color: #fff;
}

.box.go {
    background: #22c55e;
    color: #fff;
}

.box.done {
    background: #e8e8e8;
    color: #555;
}

/* buttons */
.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

button {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    padding: 12px 28px;
    cursor: pointer;
    transition: opacity 0.2s;
}

button:hover {
    opacity: 0.85;
}

button:active {
    transform: scale(0.97);
}

#startBtn {
    background: #222;
    color: #fff;
}

#retryBtn {
    background: #f0f0f0;
    color: #333;
}

/* results */
.results {
    text-align: center;
    padding: 16px;
    background: #fafafa;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #eee;
}

.time-display {
    font-size: 2.2rem;
    font-weight: 700;
    color: #111;
}

.time-display span {
    /* the number */
}

.comment {
    color: #666;
    margin-top: 4px;
    font-size: 0.9rem;
}

/* score row */
.scores {
    display: flex;
    justify-content: space-around;
    padding: 14px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin-bottom: 18px;
}

.score-item {
    text-align: center;
}

.score-item .label {
    display: block;
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.score-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}

/* little hint at bottom */
.hint {
    text-align: center;
    font-size: 0.8rem;
    color: #bbb;
    margin-bottom: 24px;
}

kbd {
    background: #eee;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 0.75rem;
}

footer {
    text-align: center;
    font-size: 0.8rem;
    color: #aaa;
}

footer a {
    color: #888;
    text-decoration: none;
    border-bottom: 1px solid #ccc;
}

footer a:hover {
    color: #444;
}

.hidden {
    display: none !important;
}

/* new best highlight */
.new-best {
    color: #f59e0b;
}

@media (max-width: 480px) {
    .wrapper {
        padding: 20px 16px 14px;
    }

    h1 { font-size: 1.45rem; }

    .time-display { font-size: 1.8rem; }

    .hint { display: none; }
}