:root {
    --move-duration: 1.0s;
    --board-bg: #edeced;/* lightgrey;*/
    --board-bg-vslot: white;
    /*--vertical-default: white;*/
    --screen-bg: #f0f0f0;
    --info-icon-color: #0088ee;/*648deb;*/
    --unfinished-fill-color: #bbbbbb;
    --vh: 1vh;
    --slide-width: 20px;
    --slot-min: 60px;
    --bank-slot-min: 50px;
    --ibank-slot-min: 30px;
    --gameboard-row-height: 55px;
    --instboard-row-height: 45px; 
    --link-color: #0088ee;
    --title-color: #black;
    --group-right-loc-color: #55dd55;
    --group-correct-on-vslot:  #68fc70;   /* triplet correct placement background color on slot (white) */
    --group-correct-on-slot: #b6f4ac;   /* triplet correct placement background color on vslot (grey) */
    --group-wrong-loc-color: #FFCC00; 
    --group-wrong-loc-on-vslot: #ffe57f;   /* triplet wrong placement background color on slot (white) */
    --group-wrong-loc-on-slot: #ead069;   /* triplet wrong placement background color on vslot (grey) */

    --group1-color: #ADD8E6; /* the less informative color set */
    --group1-color-on-vslot: #d6ebf2; /* for full background color appearing over a regular column - these are computed in Photoshop */
    --group1-color-on-slot: #c0d6dd; /* for full background color appearing over vslot columns 2 & 4 */
    --group1-color-border: #0000ff; /* the border color */
    --group2-color: #DAB1DA;
    --group2-color-on-vslot: #ecd8ec;
    --group2-color-on-slot: #d6c2d7;
    --group2-color-border: #ff00ff;
    --group3-color: #ff0000; /* was ff9900 */
    --group3-color-on-vslot: #ffe57f;
    --group3-color-on-slot: #ead069;
    --group3-color-border: #ff9900;
    
    /* emoji's for sring game results*/
    --board-bg-color-share: \u2B1C; /* ⬜ */
    --vertical-highlight-color-share: \u1F7E9; /* 🟩 */
    --group1-color-share: \u1F7E6; /* 🟦 */
    --group2-color-share: \u1F7EA; /* 🟪 */
    --group3-color-share: \u1F7E7;/* 🟧 */

    --progress-empty: #dddddd;
    --unsolved-color: #ff0000;
}

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 720px;
    width: 100vw;
    max-width: 500px;
    min-height: 500px;
    margin: 0 auto;
    font-family: 'Helvetica Neue', sans-serif;
    background-color: #fff; /* var(--screen-bg);*/
    color: #333;
    display: flex;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
}

body.loading {
    visibility: hidden;
    background: var(--screen-bg);
    overflow: hidden;
}

body.loaded {
    visibility: visible;
    overflow: hidden;
}

.full-screen {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    margin: 0 auto; /* fill in left and right sides with empty margin to keep content centered */
    height: 100%;
    max-height: 1000px;
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}
.game-wrapper {
 /*   position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-50%);
    */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    max-width: 500px;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 0.3s;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 95%;
    flex-grow: 1;
    /*justify-content: center;*/
    justify-content: flex-start;
    overflow: hidden;
    height:90%;
}
.title-row {
    display: flex;
    flex-direction: row;
    width: 100%;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0px;
    margin-top: 10px;
    gap: 10px;
    padding: 0px;
}

.title {
    font-size: 24px;
    font-weight: bold;
    text-align: left;
    flex: 1;
    color: var(--title-color);
    width: 37%;
    vertical-align: baseline;
}


.accolade {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-top: 15px;
    margin-bottom: 15px;
}
.quote {
    font-size: 16px;
    text-align: center;
    margin-top: 5px;
    margin-bottom: 15px;
}

.link {
    text-align: right;
    color: black;
    text-decoration: none;
    cursor: pointer;
    font-size: 40px;
}

.topright-link:link,
.topright-link:visited,
.topright-link:hover,
.topright-link:active {
    color: black;
}

.topright-link:hover {
    text-decoration: underline;
}

.help-link {
    color: var(--link-color);
    text-decoration: none;
    cursor: pointer;
}

.help-link:hover {
    text-decoration: underline;
}

.example {
    text-align: center;
    font-family: 'Helvetica Neue', sans-serif;
    height: 10px;
    min-height: 10px;
    margin-bottom: 10px;
    margin-top: 10px;
    padding: 10px;
}

.example-span {
    color: red;
}

.separator {
    color: black;
}

.msg { 
    display: flex;
    flex-direction: row;
    width: 100%;
    text-align: left;
}


.message-row {
    display: flex;
    align-items: center;
    flex-direction: row;
    min-width: 100%;
    max-width: 100%;
    justify-content: space-between;
    margin-bottom: 0px;
    margin-top: 5px;
    background: transparent;
    border: 0px solid black;
    padding: 4px;
}
.moves-div {
    display: inline-block;
    flex-direction: row;
    align-items: center; /* ensures vertical alignment */
    text-align: center;
    font-size: 14px;
    vertical-align: top;
    padding-right: 8px;
    width: 15%;
}

.day-msg {
    display: inline-block;
    flex-direction: row;
    align-items: center; /* ensures vertical alignment */
    text-align: center;
    vertical-align: top;
    padding-left: 8px;
    width: 55%;
    font-size: 14px;
    line-height: 1.5;
    height: calc(4 * 1.5em);
}

.tip {
    display: inline-block;
    flex-direction: row;
    align-items: center; /* ensures vertical alignment */
    text-align: left;
    vertical-align: top;
    padding-left: 8px;
    width: 80%;
    font-size: 14px;
    line-height: 1.5;
    height: calc(4 * 1.5em);
}

.emoji {
    display: inline-block;
    flex-direction: row;
    align-items: center; /* ensures vertical alignment */
    text-align: left;
    font-size: 28px;
    vertical-align: top;
    padding-left: 8px;
    width: 15%;
}
.space { 
    display: inline-block;
    flex-direction: row;
    align-items: center; /* ensures vertical alignment */
    text-align: left;
    font-size: 28px;
    vertical-align: top;
    padding-left: 8px;
    width: 20%;
}

.game-number {
    /*position:relative;*/
    display: inline-block;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 20px;
    width: 16%;
    vertical-align: baseline;
}

.title-bar-icon {
    position: relative;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    top: 4px; /* push down a little bit */
    width: 16%;
}


#groups,
#vgroups {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    flex-wrap: nowrap;
    /*height: 60.0px;*/
    /* Match SVG height */
    line-height: 1;
}

/* Grid layout: 4 flexible columns + 1 fixed column */
.slots-container {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
    /*height: 35%;*/
    margin-bottom: 1.1rem;
    padding: 0 1px;
    flex-shrink: 0;
    border-radius: 20px;

}
.slotrow,
.islotrow,
.tslotrow,
.minislotrow,
.imarker-row,
.pgmarker-row,
.marker-row {
    display:grid;
    width: 100%;
    /*height: var(--gameboard-row-height);*/
    grid-template-columns: calc( calc((100% - var(--slide-width)) / 5) + 5px ) repeat(4, calc((100% - var(--slide-width)) / 5)) var(--slide-width);
    padding: 0;
    border: none;
    margin: 0;
    align-items: center;
    row-gap: 0px;
    column-gap: 0px;
    height: 64px; /* height of .slot -2 */
}
.islotrow,.tslotrow {
    height: 58px; /*var(--instboard-row-height);*/
}
.imarker-row,
.marker-row {
    height: 24px;
    display:none;
}
.pgmarker-row { 
    height: 27px;
}
.minislotrow {
    padding-left: 20px;
    padding-right: 15px;
    height: 58px;
    grid-template-columns: repeat(5, calc(100% /5));
}

.marker { 
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 30px;
}
.leftpad, .rightpad { 
    width: 20px;
}

.slot,
.vslot,
.islot,
.ivslot,
.gen-inst-cell
{
    background-color: var(--board-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;   
    box-sizing: border-box;
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    z-index: 0;
    pointer-events: none;
    -webkit-tap-highlight-color: var(--board-bg); /* Removes blue-gray highlight on iOS */
    touch-action: manipulation; /* Improves responsiveness and disables double-tap zoom */
    user-select: none; /* Prevents accidental text selection */
    height: 45px;
    box-shadow: -3px 3px 6px 0px rgba(0,0,0,0.3);
    border: 1px solid #A9A9A9;
}

.vslot {
    background-color: var(--board-bg-vslot);
    /*border-bottom: 2px dashed #ccc;*/
    height: 66px;
}

.islot { 
    height: 42px;/* var(--instboard-row-height);*/
    border: 1px solid gray;
}

.ivslot {
    background-color: var(--board-bg-vslot);
    height: 60px; /* var(--instboard-row-height);*/
    border: 1px solid gray;
}

.slot:hover,
.vslot:hover {
    background-color: #f0f0f0;
}

.slot:active {
    background-color: inherit !important;
    box-shadow: none !important;
    outline: none !important;
}
.slot:focus,
.slot:focus-visible {
    outline: none !important;
    background-color: inherit !important;
}

.slide {
    display: flex;
    align-items: center;
    justify-content: left;
    height: var(--gameboard-row-height);
}

.slide-btn {
    width: 20px;
    height: 100%;
    object-fit:contains;
    display: block;
}
/*.slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}*/

/* Word bank layout: 4x4 grid */
.word-bank {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-gap: 2px;
    width: 100%;
    /*height: 29%;*/
    padding: 1rem 0;
    overflow: hidden;
    visibility: visible;
    flex-shrink: 0;
    text-align: center;
}

/* Responsive update (optional override for smaller slots on wide screens) */
@media (min-width: 768px) {
    .word-bank {
        grid-template-columns: repeat(5, minmax(60px, 1fr));
    }
}

/* Word styling */
.bank-slot,
.ibank-slot,
.tbank-slot {
    background-color: #fff; /*var(--screen-bg);*/
    border: 2px solid var(--screen-bg);
    border-radius: 20px;
    min-height: var(--bank-slot-min);
    max-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: grab;
    overflow: hidden;
}

.ibank-slot,.tbank-slot {
    min-height: 40px;
    height: 40px;
}
.bank-slot:active {
    cursor: grabbing;
}

.word {
    padding: 8px 3px;
    background-color: transparent;
    border-radius: 5px;
    cursor: grab;
    user-select: none;
    text-align: center;
    transition: none;
    white-space: nowrap;
    font-size: 18px;
    max-width: 100%;
    z-index: 10;
}

.word:active {
    cursor: grabbing;
}

/* Instruction / Message Popups */

.instr-full {
    position: absolute;
    top: 0;
    left: 0;
    padding: 10px;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
}

.group-border {
    position: absolute;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 50;
    border: none;
    border-bottom: 1px dashed var(--link-color);
    border-radius: 0;
    height: 0;
    display: none;
}
.instr-popup {
    width: 70%;
    max-width: 400px;
    min-height: 40%;
    /* Start at 40% but allow growth */
    max-height: 80%;
    /* Cap at 80% of parent height */
    overflow-y: auto;
    /* Scroll if content overflows */
    align-items: center;
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -20%);
    padding: 10px;
    border: 2px solid black;
    z-index: 100;
    background-color: #ddeeff;
}

.instr-header {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-size: 20px;
    padding-top: 5px;
    padding-bottom: 10px;
    width: 100%;
}

.instr-body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14;
    padding-top: 5px;
    padding-bottom: 10px;
    width: 100%;
}

.instr-form {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14;
    padding-top: 20px;
    padding-bottom: 5px;
    width: 100%;
}

.instr-close {
    padding-top: 10px;
    padding-bottom: 10px;
    padding-right: 10px;
    padding-left: 10px;
    width: 100%;
    align-content: right;
    align-items: right;
}

.instr-close button {
    background-color: #333;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.instr-close button:hover {
    background-color: #555;
}
.solve-div {
    width: 100%;
    padding: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.share {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
}

.play-button,
.share-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--group-right-loc-color);
    border-radius: 20px;
    padding: 8px 16px;
    border: 2px solid black;
    cursor: pointer;
    font-family: 'Helvetica Neue', sans-serif;
    color: black;
    gap: 6px;
    min-width: 120px;
    /*max-width: 30%;*/
    flex: 0 1 auto;
    transition: background-color 0.3s ease;

}

/*.play-button { 
    margin-left: 35%;
    margin-right: 35%;
    width: 30%;
}*/

.share-button:hover {
    background-color: var(--vertical-highlight);
}

.share-button:focus {
    outline: 2px solid var(--link-color);
    outline-offset: 2px;
}

.share-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

.share-text {
    font-size: 16px;
    font-weight: 500;
}

.share-confirmation {
    color: var(--vertical-highlight);
    font-size: 14px;
    margin-left: 10px;
    font-family: 'Helvetica Neue', sans-serif;
}

.button-array {
    display: flex;
    justify-content: center;
    gap: 5%;
    width: 100%;
}

.mode-button {
    width: 25%;
    background: var(--board-bg);
    border-radius: 7px;
    padding: 8px 2px;
    border: 2px solid black;
    cursor: pointer;
    font-family: 'Helvetica Neue', sans-serif;
    color: black;
    text-align: center;
    transition: background-color 0.3s ease;
    border: 1px solid lightgrey;
}

.mode-button.active {
    background: #ffffff; /* Optional: different background for active state */
    border: 2px solid black;
}
.drawer {
    position: fixed;
    top: 29px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    margin: 0 auto; /* fill in left and right sides with empty margin to keep content centered */
    height: 100%;
    min-height: calc(100vh - 31px);    /* Extend to bottom of viewport */
    max-height: calc(100vh - 32px);
    
    padding-top: 0px;
    padding-bottom: 0px;
    padding-left: 10px;
    padding-right: 10px;
    
    z-index: 1000;
    background: #ffffff;
    opacity: 1;
    border-top: 2px solid black;
    border-left: 2px solid black;
    border-right: 2px solid black;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    display: flex;    /* Use flexbox for content alignment */
    flex-direction: column;    /* Stack content vertically */
    align-items: flex-start;    /* Align content to the top */
    justify-content: flex-start;    /* Ensure content starts at the top */
    overflow: hidden;    /* no scrolling */
    box-sizing: border-box;    /* Include padding and border in height/width */
}

.drawer-content {
    flex-grow: 1;    /* Take remaining space */
    overflow-y: auto;    /* Enable vertical scrolling */
    overflow-x: hidden;    /* Prevent horizontal scrolling */
    width: 100%;
    box-sizing: border-box;
    /*max-height: calc(100vh - 31px); */
    max-height: 90vh !important;
    height: 100%; 
    padding-bottom: 60px;
}
.drawer-header {
    flex-shrink: 0;    /* Prevent header from shrinking */
    padding: 10px 0;    /* Adjust padding as needed */
    display: flex;
    justify-content: space-between;    /* Title on left, close button on right */
    align-items: center;
}
.drawer-content-inner {
    padding-right: 20px; /* Adjust this value to increase space between content and scrollbar */
    box-sizing: border-box;
}
.padded-image {
    padding: 10px;
    width: 60%;
    height: auto;
    max-width: 100%;
    box-sizing: border-box;
}
/* Grid layout: 4 flexible columns + 1 fixed column */
.instr-grid {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 0 1px;
    flex-shrink: 0;
    border-radius: 20px;
}

/*
.inst-row-text {
    display: block;
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
    margin: 4px;
    height: 3em;
}*/

.inst-row {
    position: relative;          /* establishes positioning context */
    overflow: hidden;            /* clip the sliding parts */
    width: 100%;
}
.inst-track {
    display: flex;               /* puts all slides side-by-side */
    width: 100%;                 /* each slide will be 100% of the container */
    transition: transform 0.8s ease-in-out;
}
.inst-row-text {
    flex: 0 0 100%;              /* take exactly the width of the container */
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
    box-sizing: border-box;
    /* no absolute, no translateX on the slide itself */
}













.fill {
    width: 100%;
    height: 100%;
}

.score-span { 
    font-size: 28px;
    line-height: 1;
    vertical-align: baseline;
}

.help-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.help-menu {
    position: absolute;
    top: 100%;
    left: -20;
    background: #fff;
    border: 1px solid var(--color-tone-1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    min-width: 210px;
    font-size: 30px;
}

.help-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.help-menu li {
    margin: 0;
}

.help-menu button {
    width: 100%;
    background: none;
    border: none;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    font-size: 18px;
}

.help-menu button:hover:not(:disabled) {
    background: #f0f0f0;
}

.help-menu button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.settings-list {
    list-style-type:disc;
    list-style-position: outside;
    padding-left: 30px;
    padding-right:20px;
    margin: 4px 0;
}

.settings-list li {
    margin-bottom: 6px;
}

/* Ensure the parent container doesn't interfere */
#controls {
    width: 100%;
    box-sizing: border-box; /* Prevent padding/margin overflow */
}

/* Flexbox row container */
.settings-row-container {
    display: flex;
    flex-direction: row; /* Explicitly horizontal */
    align-items: center; /* Vertically center content */
    width: 100%; /* Full width of parent */
    gap: 10px; /* Replace &nbsp; with consistent spacing */
    margin-bottom: 10px; /* Space between rows */
    box-sizing: border-box;
    padding-right:15px;
}

/* Label div */
.settings-label-div {
    flex: 0 0 45%; 
    text-align: left; 
    padding-top: 10px;
}

/* Content div */
.settings-content-div {
    flex: 1; /* Take remaining width */
    text-align: left; /* Left-justify */
    padding-top:10px;
}

/* Select styling */
select {
    min-height: 2.2em;
    width: 100%; /* Fill container */
    box-sizing: border-box;
}

.stats-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 10px;
}

.stats-streaks {
    flex: 0 0 40%;
    min-width: 0;
    padding: 10px;
    padding-right: 5px;
}

.stats-lifetime {
    flex: 0 0 60%;
    min-width: 0;
    padding: 10px;
    padding-left: 5px;
}

.inline-link {
    background:none;
    border:none;
    color:blue;
    text-decoration:underline;
    cursor:pointer;
    font-size:15px;
}
.word-pair-columns {
    display: flex;
    flex-direction: row;
    margin-left: 2px;
    justify-content: space-between;
    width: 100%;
    /*align-items: center;*/
}

.word-pair-column-container {
    width: 45%;
    margin: 0 1%;
}
.word-pair-column-container li {
    margin-bottom: 10px;
}
.word-pair-header {
    font-weight: bold;
    text-align: left;
    margin-bottom: 10px;
}

.word-pair-column {
    width: 100%;
    margin: 0;
    padding-left: 4px;
    list-style: disc;
}

.stats-tabs {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.tab-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.tab-button {
    flex: 1;
    padding: 6px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    cursor: pointer;
    font-family: 'Helvetica Neue', sans-serif;
    font-size: 16px;
    text-align: center;
    transition: background-color 0.3s;
}

.tab-button:hover {
    background-color: #e0e0e0;
}

.tab-button.active {
    background-color: #333;
    color: white;
    border-color: #333;
}

.tab-content {
    position: relative;
    max-height: calc(100vh - 31px); 
    overflow-y: auto;    /* Enable vertical scrolling */
    overflow-x: hidden;    /* Prevent horizontal scrolling */
}

.tab-pane {
    display: none;
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
}

.tab-pane.active {
    display: block;
}

.all-black-link:link {
            color: black;
            text-decoration: none; /* Optional: Removes default underline */
}
.all-black-link:visited {
            color: black;
}
.all-black-link:hover {
            color: black;
}
.all-black-link:focus {
            color: black;
}
.all-black-link:active {
            color: black;
}
.example-word { 
    color: blue;
    font-size: 16px;
    font-weight: bold;
    /* border: 1px solid lightgray;
    border-radius: 5px;*/
}

.gen-inst-grid {
    display: grid;
    grid-template-columns: 5% 20% 20% 20% 20% 15%;
    grid-auto-rows: max-content; /* Row height = tallest child */
    gap: 0;
    padding: 0;
    min-height: 60px; /* Minimum to fit ivslot */
    align-items: center; 
}

.gen-inst-grid2 {
    display: grid;
    grid-template-columns: 5% 20% 20% 55%;
    grid-auto-rows: max-content; /* Row height = tallest child */
    gap: 0;
    padding: 0;
    min-height: 60px; /* Minimum to fit ivslot */
    align-items: center; 
}

.gen-inst-grid3 {
    display: grid;
    grid-template-columns: 5% 20% 20% 55%;
    grid-auto-rows: max-content; /* Row height = tallest child */
    gap: 0;
    padding: 0;
    min-height: 60px; /* Minimum to fit ivslot */
    align-items: center; 
}


.button-row { 
    display: flex;
    justify-content: center; 
    gap: 20px;            
    margin: 20px 0;       
    flex-wrap: nowrap;
}