    body {
        margin: 0;
        font-family: Arial, sans-serif;
        background: #f4f4f4;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    header {
    position: sticky;   /* keeps it fixed relative to the viewport */
    top: 0;             /* stick to the very top */
    z-index: 1000;      /* ensure it stays above the text box */
    padding: 20px;
    background: #ffffff; /* solid background so text doesn’t show through */
    border-bottom: 1px solid #ccc;
}h1 {
        margin: 0 0 15px 0;
        font-size: 24px;
    }
   #buttonGrid {
    display: flex;              /* use flexbox instead of grid */
    flex-wrap: wrap;            /* allow wrapping if screen is narrow */
    justify-content: space-between;
    gap: 8px;
}

button.titleButton {
    flex: 1 1 calc(12.5% - 8px); /* 8 buttons = 12.5% each */
    min-width: 100px;            /* prevent buttons from shrinking too small */
    padding: 6px 8px;            /* shallower buttons */
    font-size: 14px;
    line-height: 1.2;
    border: 1px solid #888;
    background: #e9e9e9;
    border-radius: 4px;
    text-align: center;
}
    
    button.titleButton:hover { background: #dcdcdc; }
    button.titleButton.active {
        background: #bcd7ff;
        border-color: #2f6fcc;
    }
    button.titleButton {
    padding: 6px 8px;       /* smaller vertical padding */
    font-size: 14px;        /* slightly smaller text */
    line-height: 1.2;       /* tighter line spacing */
    cursor: pointer;
    border: 1px solid #888;
    background: #e9e9e9;
    border-radius: 4px;     /* a bit less rounded */
    text-align: left;
}
    .moreTextButton {
        display: block;
        margin: 20px auto;
        padding: 14px 24px;
        font-size: 18px;
        font-weight: bold;
        background-color: #2f6fcc;
        color: white;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        transition: background-color 0.3s ease;
    }
    .moreTextButton:hover { background-color: #1d4f99; }
    main {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 30px;
    }
    #textBox {
        width: 80%;
        min-height: 40%;
        background: white;
        border: 2px solid #999;
        border-radius: 10px;
        padding: 25px;
        font-size: 20px;
        line-height: 1.7;
        white-space: pre-wrap;
        box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    }
    .maskSquare {
        display: inline-block;
        width: 0.65em;
        height: 0.85em;
        background: #999;
        margin: 0 1px;
        vertical-align: -0.1em;
        border-radius: 2px;
    }
    .buttonRow {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

.exitButton {
  background-color: #cc3333;
}
.exitButton:hover {
  background-color: #a30000;
}
    #status { margin-top: 10px; color: #666; font-size: 14px; }
