.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 {
    list-style-type: disc;
    margin-left: 35px;
    padding-left: 0;
    margin-bottom: 20px;
    font-size: 18px;
    line-height: 1.6;
    font-weight: 300;
}

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

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

/* Container styles */
.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;
}

/* Total number */
#counter {
    font-size: 72px;
    margin: 20px 0;
}

/* -----------------------------
   Add/Remove side-by-side row
   ----------------------------- */

.tally-actions {
    width: 90%;
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

/* Add stays flexible */
.tally-actions #addTallyButton {
    flex: 1;
    width: auto;
    margin-bottom: 0;
}

/* Remove fixed width so it never gets too narrow */
.tally-actions #removeTallyButton {
    flex: 0 0 180px;
    width: 180px;
    margin-bottom: 0;
}

/* -----------------------------
   TALLY MARKS OUTPUT AREA
   - grows a lot before scrolling
   ----------------------------- */

.tally {
    width: 90%;
    box-sizing: border-box;

    min-height: 110px;
    height: auto;

    /* << doubled-ish: allow it to grow MUCH taller before scroll */
    max-height: 840px;      /* was 420px */

    overflow-y: auto;

    padding: 18px 16px;
    margin: 0 0 18px 0;
    border: 4px solid #ccc;
    border-radius: 8px;
    background: #fff;
    box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.08);

    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    align-items: flex-start;
    justify-content: flex-start;
}

/* Each group becomes a positioned container */
.tally-group {
    position: relative;
    display: inline-flex;
    align-items: flex-end;
    gap: 10px;
    height: 56px;
    padding: 4px 6px;
}

.tally-mark {
    width: 10px;
    height: 56px;
    background: #111;
    border-radius: 2px;
    display: inline-block;
}

.tally-slash {
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 10px;
    background: #111;
    border-radius: 2px;
    transform: translateY(-50%) rotate(-28deg);
    transform-origin: center;
    pointer-events: none;
}

/* -----------------------------
   Buttons + click effect
   ----------------------------- */

#addTallyButton,
#removeTallyButton,
#resetTallyButton {
    transition: transform 0.08s ease, filter 0.08s ease, box-shadow 0.08s ease;
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

.btn-clicked {
    transform: translateY(2px) scale(0.99);
    filter: brightness(0.92);
    box-shadow: 0 3px 8px rgba(0,0,0,0.14);
}

#addTallyButton:active,
#removeTallyButton:active,
#resetTallyButton:active {
    transform: translateY(2px) scale(0.99);
    filter: brightness(0.92);
    box-shadow: 0 3px 8px rgba(0,0,0,0.14);
}

/* Add button (centered label) */
#addTallyButton {
    font-size: 54px;
    padding: 32px 0;
    box-sizing: border-box;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    text-align: center;
}

#addTallyButton::before {
    content: "+";
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 54px;
    line-height: 1;
    font-weight: 700;
    opacity: 0.95;
    pointer-events: none;
}

#addTallyButton:hover { background-color: #45a049; }

/* Remove button (centered label) */
#removeTallyButton {
    font-size: 24px;
    padding: 20px 0;
    box-sizing: border-box;
    background-color: #ff5722;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    text-align: center;
}

#removeTallyButton::before {
    content: "−";
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 34px;
    line-height: 1;
    font-weight: 700;
    opacity: 0.95;
    pointer-events: none;
}

#removeTallyButton:hover { background-color: #e64a19; }

@media (max-width: 820px) {
    #removeTallyButton::before { left: 14px; font-size: 30px; }
}

/* Reset button (narrow + right aligned + taller/bigger text) */
#resetTallyButton {
    font-size: 18px;
    padding: 12px 0;
    width: 32%;
    min-width: 140px;
    box-sizing: border-box;
    background-color: #d32f2f;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 10px;
}

@media (min-width: 601px) {
    #resetTallyButton {
        margin-left: auto;
        margin-right: 5%;
    }
}

#resetTallyButton:hover { background-color: #c62828; }

/* Text styles */
.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; }

.highlight {
    background-color: yellow;
    font-weight: bold;
}

/* ---------------------------------
   Responsive / layout adjustments
   --------------------------------- */

@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 { display: none; }
    .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 {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        grid-column-gap: 0px;
        grid-row-gap: 0px;
    }

    .div3-vowel { grid-area: 1 / 1 / 2 / 2; }
}

/* Mobile */
@media (max-width: 600px) {
    .vc-container { padding: 15px; }
    .vc-title { font-size: 36px; }

    #counter {
        font-size: 60px;
        margin: 16px 0;
    }

    .tally-actions {
        width: 100%;
        flex-direction: column;
    }

    .tally-actions #addTallyButton,
    .tally-actions #removeTallyButton {
        width: 100%;
        flex: 0 0 auto;
    }

    #addTallyButton::before { left: 18px; font-size: 44px; }
    #removeTallyButton::before { left: 14px; font-size: 30px; }

    /* Let it grow a lot on mobile too (but still not insane) */
    .tally {
        width: 100%;
        min-height: 96px;
        padding: 14px 12px;
        max-height: 640px;   /* was 320px */
    }

    .tally-group { height: 46px; gap: 8px; padding: 3px 5px; }
    .tally-mark { width: 8px; height: 46px; }
    .tally-slash { height: 8px; }

    #resetTallyButton {
        width: 100%;
        min-width: 0;
        margin-left: 0;
        margin-right: 0;
        font-size: 18px;
        padding: 12px 0;
    }
}

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