html {
    font-family: Heebo, Arial, system-ui, sans-serif;
    touch-action: pan-y;
}
body {
    margin: 0 !important;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

body.default {
    --body-bg: #F2F8EC;
    --body-text: #1C1F19;
    --board-bg: #3B3535;
    --square-empty: #5E5555;
    --square-2-bg: #F2F8EC;
    --square-2-text: #1C1F19;
    --square-4-bg: #C4D2B5;
    --square-4-text: #1C1F19;
    --square-8-bg: #9FAA92;
    --square-8-text: #EFEEEE;
    --square-16-bg: #E9BCBC;
    --square-16-text: #EFEEEE;
    --square-32-bg: #DD8989;
    --square-32-text: #EFEEEE;
    --square-64-bg: #CF5050;
    --square-64-text: #EFEEEE;
    --square-128-bg: #963838;
    --square-128-text: #EFEEEE;
    --square-256-bg: #91ABAB;
    --square-256-text: #EFEEEE;
    --square-512-bg: #708585;
    --square-512-text: #EFEEEE;
    --square-1024-bg: #B78FD8;
    --square-1024-text: #EFEEEE;
    --square-2048-bg: #9D60C5;
    --square-2048-text: #EFEEEE;
    --square-4096-bg: #734193;
    --square-4096-text: #EFEEEE;
    --square-8192-bg: #49285F;
    --square-8192-text: #EFEEEE;
    --square-16384-bg: #49285F;
    --square-16384-text: #EFEEEE;
    --square-32768-bg: #49285F;
    --square-32768-text: #EFEEEE;
}

body.dark {
    --body-bg: #16181d;
    --body-text: #edf2f7;
    --board-bg: #272a31;
    --square-empty: #3a3f48;
    --square-2-bg: #f0f3f7;
    --square-2-text: #16181d;
    --square-4-bg: #cad3de;
    --square-4-text: #16181d;
    --square-8-bg: #84b4c9;
    --square-8-text: #f7fbff;
    --square-16-bg: #7a88b8;
    --square-16-text: #f7fbff;
    --square-32-bg: #6570ad;
    --square-32-text: #f7fbff;
    --square-64-bg: #4d5897;
    --square-64-text: #f7fbff;
    --square-128-bg: #8c5fbc;
    --square-128-text: #f7fbff;
    --square-256-bg: #a14f9d;
    --square-256-text: #f7fbff;
    --square-512-bg: #bf637a;
    --square-512-text: #f7fbff;
    --square-1024-bg: #d48559;
    --square-1024-text: #1b1b1b;
    --square-2048-bg: #f0bc5f;
    --square-2048-text: #1b1b1b;
    --square-4096-bg: #d99645;
    --square-4096-text: #1b1b1b;
    --square-8192-bg: #e7d8a4;
    --square-8192-text: #1b1b1b;
    --square-16384-bg: #e7d8a4;
    --square-16384-text: #1b1b1b;
    --square-32768-bg: #e7d8a4;
    --square-32768-text: #1b1b1b;
}

.hidden {
    display: none !important;
}

body {
    background: var(--body-bg);
    color: var(--body-text);
    font-size: 20px;
}

.allcontent-container {
    display:block;
    width: 500px;
    margin: 0 auto;
    padding: 0;
    position: relative;
}

.profile-selector {
    position: absolute;
    right: 2px;
    top: 4px;
}
span.selected-profile-name {
    position: relative;
    bottom: 9px;
    left: 4px;
    font-weight: 500;
}
.available-profiles {
    position: absolute;
    right: 0;
    top: 0;
    background: transparent;
    color: #f2f8ec;
    border-radius: 4px;
    padding: 4px 8px;
    margin-top: 4px;
    width: max-content;
    z-index: 1000;
}
.available-profiles .profile-option {
    border: 1px solid white;
    margin: 3px;
    border-radius: 4px;
    padding: 1px 6px;
    background: #9d60c5;
}
.profile-option:hover {
    text-decoration: underline;
    cursor: pointer;
}
.profile-option.selected {
    background: #9FAA92;
    font-weight: 600;
}
.profile-option.profile-unused:after {
    content: "(available)";
    margin-left: 4px;
    font-size: .7em;
    bottom: 2px;
    position: relative;
}

h1 {
    font-size: 48px;
}
.header-menu {
    width: 100%;
}
.headings {
    display:inline-block;
    vertical-align: middle;
    width: 32%;
    position:relative;
}
.headings.header-middle {
    text-align: center;
}
.headings .imagebutton {
    display: inline-block;
    vertical-align: middle;
}
button.textbutton {
    background: #49285F;
    color: #EFEEEE;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 18px;
}
button.textbutton:hover {
    background: #734193;
}
button.imagebutton {
    border-radius: 18px;
    border: 0;
    background: transparent;
}
button.imagebutton:hover {
    background: #efeeee;
}
button.imagebutton.stats {
    position: relative;
    left: 80%;
}
button.imagebutton.settings img, button.imagebutton.help img {
    width: 44px;
    height: 44px;
    padding: 3px 0px 2px;
}
button.imagebutton img {
    width: 28px;
    height: 28px;
    padding: 3px 0px 2px;
}
h1, .header-menu {
    display: inline-block;
    vertical-align: middle;
}
.footer {
    margin-top: 20px;
}
.stats-leaderboards {
    width: 96%;
    margin: 0 auto;
    border: 1px outset grey;
    border-radius: 4px;
}
.score-container, .bestscore-container {
    background: #9D60C5;
    color: #efeeee;
    width: 200px;
    text-align: center;
    margin: 0 auto;
    border-radius: 6px;
    display: inline-block;
}
.bestscore-container {
    width: 180px;
}
.score {
    width: fit-content;
    margin: 0 auto 20px;
}
.score-value, .bestscore-value {
    font-size: 32px;
    font-weight: 500;
}

.popupMessage {
    position: absolute;
    left: 0;
    right: 0;
    top: 3%;
    border: 1px solid #1C1F19;
    background: #ECF8F8;
    width: 85%;
    max-width: 460px;
    margin: 0 auto;
    border-radius: 4px;
    padding: 4px 8px;
    z-index: 1005;
}

.settings-popup {
    border-radius: 6px;
    overflow: hidden;
}

.settings-popup-body {
    padding: 12px;
    display: grid;
    gap: 14px;
}

.settings-section {
    border: 1px solid #d7dde1;
    border-radius: 6px;
    padding: 12px;
    background: #fbfcfa;
}

.settings-label {
    display: block;
    margin: 0 0 8px;
    font-weight: 700;
    font-size: 18px;
}

.settings-theme-select,
.settings-profile-name,
.settings-guest-score {
    -webkit-user-select: text;
    user-select: text;
    width: 100%;
    border: 1px solid #b7bec4;
    border-radius: 6px;
    background: #ffffff;
    color: #1c1f19;
    padding: 9px 10px;
    font-size: 16px;
    box-sizing: border-box;
}

.profile-name-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.guest-score-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.profile-name-form .settings-profile-name {
    flex: 1 1 auto;
}

.guest-score-form .settings-guest-score {
    flex: 1 1 auto;
}

.settings-note {
    margin-top: 8px;
    font-size: 14px;
    color: #666;
}

.settings-feedback {
    border: 1px solid #cf5050;
    background: #fff0f0;
    color: #8d2c2c;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 15px;
    font-weight: 600;
}

.stats-popup {
    max-height: 92vh;
    overflow-y: auto;
    padding: 6px 4px 10px;
}

.stats-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0;
    padding: 10px 12px;
    background: linear-gradient(90deg, #49285F 0%, #9D60C5 45%, #49285f 100%);
    border-radius: 4px 4px 0 0;
}

.stats-popup-header h2 {
    margin: 0;
    font-size: 30px;
    color: #efeeee;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.stats-popup button.textbutton {
    font-size: 14px;
    padding: 6px 10px;
}

.popup-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-scope-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    flex-wrap: wrap;
}

.stats-scope-button {
    border: 1px solid #5e5555;
    border-radius: 999px;
    background: #f2f8ec;
    color: #1c1f19;
    padding: 7px 14px;
    font-weight: 700;
    font-size: 14px;
}

.stats-scope-button.active {
    background: #49285f;
    color: #efeeee;
    border-color: #49285f;
}

.stats-timeframe-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.stats-tab {
    border: 1px solid #5e5555;
    border-radius: 4px;
    background: #f2f8ec;
    color: #1c1f19;
    padding: 6px;
    font-weight: 600;
}

.stats-tab.active {
    background: #9d60c5;
    color: #efeeee;
    border-color: #734193;
}

.stats-leaderboard .lb-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: calc(5 * 36px + 4 * 4px);
    overflow-y: auto;
    margin: 0 0 10px;
    padding: 0 4px 0 0;
}

.stats-leaderboard .lb-grid-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 5px;
    border: 1px solid #d7dde1;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
}

.stats-leaderboard .lb-num {
    font-weight: 700;
    color: #666;
    font-size: 16px;
    flex-shrink: 0;
}

.lb-score {
    text-align: left;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    width: 82px;
}

.lb-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: #2e2a2a;
}

.lb-date {
    color: #888;
    font-size: 15px;
    flex-shrink: 0;
}

.guest-score-delete-inline {
    border: 0;
    background: none;
    padding: 0;
    margin: 0 0 0 4px;
    font: inherit;
    font-weight: 700;
    color: inherit;
    cursor: pointer;
    line-height: 1;
    vertical-align: middle;
}

.guest-score-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: initial;
}


.stats-summary h3 {
    margin: 4px 0 8px;
    font-size: 22px;
}

.stats-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 4px 0 8px;
}

.stats-summary-header h3 {
    margin: 0;
}

.stats-summary-header .textbutton {
    flex-shrink: 0;
}

.stats-averages .avg-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(7, auto);
    grid-auto-flow: column;
    gap: 2px;
}

.stats-averages .avg-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #d7dde1;
    border-radius: 4px;
    padding: 5px 7px;
    background: #fbfcfa;
}

.stats-averages .avg-label {
    font-weight: 600;
    color: #2e2a2a;
}

.stats-averages .avg-value {
    font-weight: 700;
    color: #1c1f19;
}

.graph-range-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}

.graph-tab {
    border: 1px solid #5e5555;
    border-radius: 4px;
    background: #f2f8ec;
    color: #1c1f19;
    padding: 6px;
    font-weight: 600;
    font-size: 13px;
}

.graph-tab.active {
    background: #9d60c5;
    color: #efeeee;
    border-color: #734193;
}

.graph-panel {
    margin-top: 4px;
}

.graph-meta {
    margin: 0 0 8px;
    font-size: 14px;
    color: #5e5555;
}

.graph-frame {
    border: 1px solid #d7dde1;
    border-radius: 6px;
    background: linear-gradient(180deg, #ffffff 0%, #f7faf4 100%);
    padding: 8px;
}

.score-graph {
    display: block;
    width: 100%;
    height: 320px;
}

.graph-axis {
    stroke: #706666;
    stroke-width: 1.4;
}

.graph-grid-line {
    stroke: #d9dee2;
    stroke-width: 1;
    stroke-dasharray: 3 5;
}

.graph-line {
    fill: none;
    stroke: #49285f;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.graph-trend-line {
    stroke: #cf5050;
    stroke-width: 2;
    stroke-dasharray: 7 6;
    stroke-linecap: round;
    opacity: 0.95;
}

.graph-legend-line {
    stroke: #cf5050;
    stroke-width: 2;
    stroke-dasharray: 7 6;
    stroke-linecap: round;
}

.graph-legend-text {
    fill: #6e6464;
    font-size: 12px;
    font-weight: 700;
}

.graph-area {
    fill: rgba(157, 96, 197, 0.14);
}

.graph-axis-title {
    fill: #2f2929;
    font-size: 15px;
    font-weight: 700;
    text-anchor: middle;
}

.graph-axis-label {
    fill: #6e6464;
    font-size: 12px;
}

.graph-axis-label-y {
    text-anchor: end;
}

.graph-empty {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6e6464;
    font-size: 18px;
    font-weight: 600;
    border: 1px dashed #d7dde1;
    border-radius: 6px;
    background: #fbfcfa;
}

.game-over-popup {
    background: #fbfcfa;
    border-radius: 6px;
    max-width: 400px;
    margin: 0 auto;
}

.go-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(90deg, #1c1f19 0%, #3b3535 45%, #49285f 100%);
    border-radius: 6px 6px 0 0;
}

.go-popup-header h2 {
    margin: 0;
    font-size: 28px;
    color: #efeeee;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    font-weight: 700;
}

.go-popup-header button.textbutton {
    font-size: 13px;
    padding: 5px 10px;
}

.go-score-section {
    padding: 24px 20px;
    text-align: center;
}

.go-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.go-score-number {
    font-size: 56px;
    font-weight: 700;
    color: #1c1f19;
}

.go-score-label {
    font-size: 18px;
    color: #666;
    font-weight: 500;
}

.go-high-score-notice {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 12px;
    background: #FFF5E6;
    border: 2px solid #D4A574;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    color: #8B6F47;
    text-transform: capitalize;
}

.new-game-confirm-popup {
    background: #fbfcfa;
    border-radius: 6px;
    max-width: 420px;
    margin: 0 auto;
}

.settings-confirm-popup strong {
    font-weight: 700;
}

body.dark .available-profiles {
    color: #edf2f7;
}

body.dark button.imagebutton:hover {
    background: rgba(255, 255, 255, 0.14);
}

body.dark .score-container,
body.dark .bestscore-container {
    background: #343848;
    color: #edf2f7;
}

body.dark .imagebutton img {
    filter: invert(1);
}

body.dark .popupMessage,
body.dark .game-over-popup,
body.dark .new-game-confirm-popup,
body.dark .settings-section,
body.dark .graph-frame,
body.dark .graph-empty,
body.dark .stats-averages .avg-row,
body.dark .stats-leaderboard .lb-grid-item {
    background: #232831;
    color: #edf2f7;
    border-color: #3d4654;
}

body.dark .stats-tab,
body.dark .stats-scope-button,
body.dark .graph-tab,
body.dark .settings-theme-select,
body.dark .settings-profile-name,
body.dark .settings-guest-score,
body.dark .share-code-value {
    background: #1a1f27;
    color: #edf2f7;
    border-color: #4b5566;
}

body.dark .stats-scope-button.active {
    background: #c0a4ff;
    color: #16181d;
    border-color: #c0a4ff;
}

body.dark .graph-meta,
body.dark .lb-date,
body.dark .lb-name,
body.dark .settings-note,
body.dark .go-score-label,
body.dark .graph-axis-label,
body.dark .graph-axis-title,
body.dark .stats-averages .avg-label,
body.dark .stats-averages .avg-value,
body.dark .lb-num,
body.dark .go-score-number,
body.dark .new-game-confirm-body p {
    color: #dbe4ee;
}

body.dark .graph-grid-line {
    stroke: #485567;
}

body.dark .graph-axis {
    stroke: #94a0b4;
}

body.dark .graph-line {
    stroke: #c0a4ff;
}

body.dark .graph-trend-line {
    stroke: #ff9f7a;
}

body.dark .graph-legend-line {
    stroke: #ff9f7a;
}

body.dark .graph-legend-text {
    fill: #dbe4ee;
}

body.dark .graph-area {
    fill: rgba(192, 164, 255, 0.18);
}

body.dark .settings-feedback {
    background: #47292b;
    color: #ffd9d9;
    border-color: #cf6a6a;
}

.new-game-confirm-body {
    padding: 22px 18px;
    text-align: center;
}

.new-game-confirm-body p {
    margin: 0 0 14px;
    font-size: 18px;
    color: #2e2a2a;
}

.new-game-confirm-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.help-popup-body {
    text-align: left;
    padding: 18px 18px 16px;
}

.help-steps {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 8px;
}

.help-steps li {
    line-height: 1.35;
}

.stats-footer-actions {
    display: flex;
    justify-content: center;
    margin: 10px 0 2px;
}

.stats-footer-actions .textbutton:disabled {
    opacity: 0.45;
    cursor: default;
}

.go-score-display .share-last-game {
    margin-top: 6px;
    padding: 0 16px 4px;
}
.share-last-game img {
    filter: invert(1);
    display: inline-block;
    height: 32px;
    width: 32px;
    position: relative;
    top: 4px;
    left: -2px;
}
.share-last-game span {
    position: relative;
    bottom: 5px;
    left: -2px;
}
.share-last-game.stats-share img {
    top: 0;
}
.share-last-game.stats-share span {
    bottom: 10px;
}

.share-code-value {
    width: 100%;
    min-height: 72px;
    border: 1px solid #b7bec4;
    border-radius: 6px;
    background: #ffffff;
    color: #1c1f19;
    padding: 8px 10px;
    font-size: 15px;
    resize: vertical;
    box-sizing: border-box;
    margin: 0 0 12px;
    -webkit-user-select: text;
    user-select: text;
}

.go-stats-section {
    padding: 0 20px 18px;
}

.go-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.go-stat-row-wide {
    grid-column: auto;
}

.go-tile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, auto);
    grid-auto-flow: column;
    gap: 6px;
}

.go-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #d7dde1;
    border-radius: 4px;
    background: #fbfcfa;
    padding: 6px 8px;
}

.go-stat-label {
    font-size: 15px;
    font-weight: 600;
    color: #2e2a2a;
}



.go-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #1c1f19;
}

div#page-cover {
    position: fixed;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, .4);
    left: 0;
    top: 0;
    z-index: 999;
}

.game-container {
    width: 500px;
    height: 500px;
    background: var(--board-bg);
    border-radius: 12px;
    margin: 0 auto;
}
.square-container {
    width: 500px;
    height: 500px;
    padding: 0px;
}
.square-grid {
    width: 472px;
    height: 472px;
    margin: 14px;
    position: relative;
    top: 14px;
    display: flex;
    flex-flow: wrap;
    gap: 14px;
    justify-content: center;
}
.square-spot {
    background: var(--square-empty);
    border-radius: 4px;
    padding: 0px;
    margin: 0;
    flex: 0 0 calc(25% - 14px);
    aspect-ratio: 1 / 1;
    display: flex;
    flex-grow: 1;
}
.square {
    width: 100%;
    border-radius: 4px;
    position: relative;
    transform: none;
    opacity: 1;
    transition: all 160ms ease;
}
.square.square-2 {
    background: var(--square-2-bg);
    color: var(--square-2-text);
}
.square.square-4 {
    background: var(--square-4-bg);
    color: var(--square-4-text);
}
.square.square-2 {
    background: var(--square-2-bg);
    color: var(--square-2-text);
}
.square.square-4 {
    background: var(--square-4-bg);
    color: var(--square-4-text);
}
.square.square-8 {
    background: var(--square-8-bg);
    color: var(--square-8-text);
}
.square.square-16 {
    background: var(--square-16-bg);
    color: var(--square-16-text);
}
.square.square-32 {
    background: var(--square-32-bg);
    color: var(--square-32-text);
}
.square.square-64 {
    background: var(--square-64-bg);
    color: var(--square-64-text);
}
.square.square-128 {
    background: var(--square-128-bg);
    color: var(--square-128-text);
}
.square.square-256 {
    background: var(--square-256-bg);
    color: var(--square-256-text);
}
.square.square-512 {
    background: var(--square-512-bg);
    color: var(--square-512-text);
}
.square.square-1024 {
    background: var(--square-1024-bg);
    color: var(--square-1024-text);
}
.square.square-2048 {
    background: var(--square-2048-bg);
    color: var(--square-2048-text);
}
.square.square-4096 {
    background: var(--square-4096-bg);
    color: var(--square-4096-text);
}
.square.square-8192 {
    background: var(--square-8192-bg);
    color: var(--square-8192-text);
}
.square.square-16384 {
    background: var(--square-16384-bg);
    color: var(--square-16384-text);
}
.square.square-32768 {
    background: var(--square-32768-bg);
    color: var(--square-32768-text);
}

.square span {
    font-size: 62px;
    line-height: 62px;
    top: 25px;
    font-weight: 700;
    width: fit-content;
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    margin: 0 auto;
}
.square-128 span, .square-256 span, .square-512 span {
    font-size: 48px;
}
.square-1024 span, .square-2048 span, .square-4096 span, .square-8192 span {
    font-size: 36px;
}
.square-16384 span, .square-32768 span {
    font-size: 28px;
    line-height: 28px;
    top: 45px;
}
.square.square-appear {
    transform: scale(.5);
    opacity: .5;
}

.square.square-merge-bulge {
    animation: square-merge-bulge 200ms ease;
}

@keyframes square-merge-bulge {
    0% {
        transform: scale(1);
    }
    55% {
        transform: scale(1.12);
    }
    100% {
        transform: scale(1);
    }
}

@media (max-width: 500px) {
    .allcontent-container {
        width: 440px;
    }
    .game-container {
        width: 440px;
        height: 440px;
    }
    .square-container {
        width: 440px;
        height: 440px;
    }
    .square-grid {
        width: 424px;
        height: 424px;
        margin: 8px;
        top: 8px;
        gap: 8px;
    }
    .square-spot {
        flex: 0 0 calc(25% - 8px);
    }
    .square span {
        top: 22px;
    }
    .square-16384 span, .square-32768 span {
        top: 38px;
    }
    .avg-row {
        font-size: 18px;
    }
    button.imagebutton.stats {
        left: 68%;
    }
}
@media (max-width: 439px) {
    .allcontent-container {
        width: 424px;
    }
    .game-container {
        width: 424px;
        height: 424px;
    }
    .square-container {
        width: 424px;
        height: 424px;
    }
    .square-grid {
        width: 408px;
        height: 408px;
        margin: 8px;
        top: 8px;
        gap: 8px;
    }
    .square-spot {
        flex: 0 0 calc(25% - 6px);
    }
    .square span {
        top: 20px;
    }
    .square-16384 span, .square-32768 span {
        top: 36px;
    }
    .avg-row {
        font-size: 18px;
    }
    button.imagebutton.stats {
        left: 70%;
    }
}
@media (max-width: 429px) {
    .allcontent-container {
        width: 412px;
    }
    .game-container {
        width: 412px;
        height: 412px;
    }
    .square-container {
        width: 412px;
        height: 412px;
    }
    .square-grid {
        width: 396px;
        height: 396px;
        margin: 8px;
        top: 8px;
        gap: 8px;
    }
    .square-spot {
        flex: 0 0 calc(25% - 6px);
    }
    .square span {
        top: 20px;
    }
    .square-16384 span, .square-32768 span {
        top: 34px;
    }
    .avg-row {
        font-size: 18px;
    }
}
@media (max-width: 412px) {
    .allcontent-container {
        width: 392px;
    }
    .game-container {
        width: 392px;
        height: 392px;
    }
    .square-container {
        width: 392px;
        height: 392px;
    }
    .square-grid {
        width: 376px;
        height: 376px;
        margin: 8px;
        top: 8px;
        gap: 8px;
    }
    .square-spot {
        flex: 0 0 calc(25% - 6px);
    }
    .square span {
        top: 17px;
    }
    .avg-row {
        font-size: 16px;
    }

    .graph-range-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .score-graph {
        height: 260px;
    }
    .square-128 span, .square-256 span, .square-512 span {
        font-size: 46px;
    }
    .square-1024 span, .square-2048 span, .square-4096 span, .square-8192 span {
        font-size: 34px;
    }
    .square-16384 span, .square-32768 span {
        font-size: 26px;
        line-height: 26px;
        top: 34px;
    }
}
@media (max-width: 391px) {
    .allcontent-container {
        width: 372px;
    }
    .game-container {
        width: 372px;
        height: 372px;
    }
    .square-container {
        width: 372px;
        height: 372px;
    }
    .square-grid {
        width: 356px;
        height: 356px;
        margin: 8px;
        top: 8px;
        gap: 8px;
    }
    .square-spot {
        flex: 0 0 calc(25% - 6px);
    }
    .square span {
        top: 14px;
    }
    .avg-row {
        font-size: 16px;
    }

    .stats-summary-header {
        align-items: flex-start;
    }

    .graph-range-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .graph-tab {
        font-size: 12px;
    }

    .popup-header-actions {
        gap: 6px;
    }
    .square-128 span, .square-256 span, .square-512 span {
        font-size: 44px;
    }
    .square-1024 span, .square-2048 span, .square-4096 span, .square-8192 span {
        font-size: 34px;
    }
    .square-16384 span, .square-32768 span {
        font-size: 25px;
        line-height: 25px;
        top: 33px;
    }
    .score-value, .bestscore-value {
        font-size: 30px;
    }
    .score-container, .bestscore-container {
        width: 160px;
        font-size: 18px;
    }
    .bestscore-container {
        width: 154px;
    }
    button.imagebutton.stats {
        left: 66%;
    }
}
@media (max-width: 371px) { /* smallest breakpoint */
    .allcontent-container {
        width: 316px;
    }
    .game-container {
        width: 316px;
        height: 316px;
    }
    .square-container {
        width: 316px;
        height: 316px;
    }
    .square-grid {
        width: 300px;
        height: 300px;
        margin: 8px;
        top: 8px;
        gap: 8px;
    }
    .square-spot {
        flex: 0 0 calc(25% - 6px);
    }
    .square span {
        top: 9px;
    }
    .square span {
        font-size: 54px;
        line-height: 54px;
    }
    .avg-row {
        font-size: 12px;
    }
    .square-128 span, .square-256 span, .square-512 span {
        font-size: 36px;
    }
    .square-1024 span, .square-2048 span, .square-4096 span, .square-8192 span {
        font-size: 28px;
    }
    .square-16384 span, .square-32768 span {
        font-size: 20px;
        line-height: 20px;
        top: 28px;
    }
    .score-value, .bestscore-value {
        font-size: 30px;
    }
    .score-container, .bestscore-container {
        width: 148px;
        font-size: 16px;
    }
    .bestscore-container {
        width: 142px;
    }
    button.imagebutton.stats {
        left: 58%;
    }
    button.imagebutton.help, button.imagebutton.settings {
        padding: 0;
    }
    button.imagebutton.settings img, button.imagebutton.help img {
        width: 40px;
        height: 40px;
        padding: 1px 0px 0px;
    }
}