.footer { width: 100%; }

.parent-vowel {
    display: grid;
    grid-template-columns: 1fr 8fr 1fr 300px;
    grid-template-rows: 1fr;
    grid-column-gap: 2px;
    grid-row-gap: 2px;
}

.div1-vowel { grid-area: 1 / 1 / 2 / 2; }
.div2-vowel { grid-area: 1 / 3 / 2 / 4; }
.div3-vowel { grid-area: 1 / 2 / 2 / 3; }
#sidebar { grid-area: 1 / 4 / 2 / 5; }

.text { padding: 5px; }

.text ul, .text ol {
    margin-left: 35px;
    padding-left: 0;
    margin-bottom: 20px;
    font-size: 18px;
    line-height: 1.6;
    font-weight: 300;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
}

.vc-container {
    max-width: none;
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #FFFFFF;
}

.vc-title {
    font-size: 56px;
    color: #333;
    margin: 0 auto;
    text-align: center;
    padding: 10px 0;
}

.parent-vowel p {
    margin-bottom: 20px;
    font-size: 18px;
    line-height: 1.6;
    font-weight: 300;
}

.text a { color: #1A73E8; }
.parent-vowel h2, h3 { margin-bottom: 20px; }

#counter {
    font-size: 72px;
    margin: 20px 0 6px;
}

/* Hint under counter */
.space-hint {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 300;
    color: #333;
}

.space-hint kbd{
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* ----- icon + centered text button helpers ----- */
.btn-with-icon{
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.btn-with-icon .btn-icon{
    position: absolute;
    left: 18px;
    font-weight: 700;
    line-height: 1;
}

.btn-with-icon .btn-text{
    width: 100%;
    text-align: center;
}

/* Big visual Spacebar button (does NOT count clicks) */
#spacebarButton {
    font-size: 54px;
    padding: 32px 0;
    width: 90%;
    box-sizing: border-box;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: default;
    transition: all 0.12s;
    margin-bottom: 14px;
}

#spacebarButton .btn-icon{
    font-size: 40px;
    left: 16px;
    opacity: 0.95;
}

#spacebarButton.pulse {
    transform: translateY(2px);
    box-shadow: 0 5px #666;
}

/* Timer row */
.timer-row{
    width: 90%;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin: 6px 0 14px;
}

.timer-item{
    font-size: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.timer-label{
    margin-right: 6px;
    opacity: 0.9;
}

/* Pills */
.timer-preset{
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #cdd;
    background: #fff;
    cursor: pointer;
    transition: transform 0.05s, box-shadow 0.12s, border-color 0.12s, opacity 0.12s;
}

.timer-preset:active { transform: translateY(1px); }

.timer-preset.active{
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}

.timer-preset:disabled{
    opacity: 0.55;
    cursor: not-allowed;
}

/* Stat chips */
.stat-chips{
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: center;
}

.stat-chip{
    min-width: 140px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #f7f7f7;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.stat-chip-label{
    font-size: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: #555;
}

.stat-chip-value{
    font-size: 24px;
    font-weight: 700;
    color: #1a73e8;
}

/* Hint (we will show/hide via JS) */
.timer-hint{
    width: 90%;
    margin: -6px 0 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed #cdd;
    background: #fbfdff;
    color: #333;
    font-size: 15px;
    text-align: center;
    display: none;
}

/* Results card base */
.results-card{
    width: 90%;
    margin: 6px 0 14px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #d6e6ff;
    background: #f3f8ff;
    box-shadow: 0 10px 30px rgba(26,115,232,0.10);
    display: none;
}

.results-title{
    font-size: 22px;
    font-weight: 800;
    color: #1a73e8;
    text-align: center;
    margin-bottom: 10px;
}

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

.results-metric{
    border: 1px solid rgba(0,0,0,0.12);
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}

.results-label{
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #555;
    margin-bottom: 6px;
}

.results-value{
    font-size: 28px;
    font-weight: 800;
    color: #1a73e8;
}

.results-sub{
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
    color: #333;
}

.try-again-primary{
    margin-top: 12px;
    width: 100%;
    padding: 14px 12px;
    border-radius: 10px;
    border: none;
    background: #1a73e8;
    color: #fff;
    font-weight: 800;
    font-size: 18px;
    cursor: pointer;
}

.try-again-primary:active{
    transform: translateY(1px);
}

/* Button row */
.button-row{
    width: 90%;
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#decrementButton {
    flex: 1.2;
    font-size: 24px;
    padding: 20px 0;
    box-sizing: border-box;
    background-color: #ff5722;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

#decrementButton .btn-icon{ font-size: 28px; }

#resetButton {
    flex: 1;
    font-size: 18px;
    padding: 20px 0;
    box-sizing: border-box;
    background-color: #d32f2f;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

/* Try Again button (row) */
#tryAgainButton{
    flex: 1;
    font-size: 18px;
    padding: 20px 0;
    box-sizing: border-box;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    display: none;
}

#tryAgainButton:hover { background-color: #1666cc; }
#tryAgainButton:active {
    background-color: #1256ad;
    box-shadow: 0 3px #666;
    transform: translateY(2px);
}

/* Hover/active (decrement/reset) */
#decrementButton:hover { background-color: #e64a19; }
#decrementButton:active {
    background-color: #d84315;
    box-shadow: 0 5px #666;
    transform: translateY(4px);
}

#resetButton:hover { background-color: #c62828; }
#resetButton:active {
    background-color: #b71c1c;
    box-shadow: 0 3px #666;
    transform: translateY(2px);
}

/* ✅ OFFICIAL END SCREEN (modal) */
.run-finished::before{
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9998;
}

.run-finished #resultsCard{
    display: block !important;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(720px, 92vw);
    z-index: 9999;
    margin: 0;
    box-shadow: 0 20px 80px rgba(0,0,0,0.35);
}

.run-finished #spacebarButton,
.run-finished #counter,
.run-finished .timer-row,
.run-finished .timer-hint{
    opacity: 0.5;
    pointer-events: none;
}

/* Responsive */
@media (min-width: 1200px) {
    .div3-vowel { max-width: 900px; }
}

@media (max-width: 1200px) {
    .parent-vowel {
        display: grid;
        grid-template-columns: 1fr 300px;
        grid-template-rows: 1fr;
        grid-column-gap: 2px;
        grid-row-gap: 2px;
    }
    .div1-vowel, .div2-vowel { display: none; }
    .div3-vowel { grid-area: 1 / 1 / 2 / 2; }
    #sidebar { grid-area: 1 / 2 / 2 / 3; }
}

@media (max-width: 992px) {
    .vc-title { font-size: 42px; }
    .parent-vowel { grid-template-columns: 1fr; }
    .div3-vowel { grid-area: 1 / 1 / 2 / 2; }
    .results-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    #spacebarButton { width: 100%; }
    .timer-row { width: 100%; }
    .button-row { width: 100%; flex-direction: column; }
    #decrementButton, #tryAgainButton, #resetButton { width: 100%; }
    .vc-title { font-size: 36px; }
}

@media (max-width: 400px) {
    .vc-container { padding: 10px; }
    .text { padding: 5px; }
}