:root { color-scheme: light; --ink: #0b1a33; --muted: #66758a; --primary: #006acd; --border: #e5ebf3; --gap: 12px; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: #f4f7fc; color: var(--ink); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid #63b7de; outline-offset: 4px; }
[hidden] { display: none !important; }
.game-header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; flex-shrink: 0; min-height: 66px; padding: 5px 28px; background: #fff; border-bottom: 1px solid #e7edf5; }
.game-plan { justify-self: start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px; font-size: .8rem; font-weight: 500; }
.game-plan strong { font-size: .85rem; font-style: italic; font-weight: 800; }
.game-plan.is-free { color: #16803d; background: #eaf8ef; }
.game-title { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; font-size: 1.325rem; font-weight: 700; line-height: 1.4; }
.game-title-icon { display: grid; place-items: center; width: 36px; height: 36px; color: #006acd; font-size: 1.5rem; }
.game-title-icon > i { display: flex; align-items: center; justify-content: center; line-height: 1; }
.game-open-link { display: inline-flex; align-items: center; gap: 6px; justify-self: end; color: #69798d; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.game-open-link:hover { color: #006acd; text-decoration: none; }
.game-open-link:focus-visible, .game-header .tool-header-brand:focus-visible { outline: 3px solid #8ec7ff; outline-offset: 4px; }
.game-page { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; padding: 32px 24px 16px; }
.game-wrapper { display: flex; flex: 1 0 auto; align-items: center; justify-content: center; width: 100%; }
.section-kicker { margin: 0 0 8px; color: #73939d; font-size: 12px; letter-spacing: 1px; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); gap: 24px; align-items: stretch; width: 100%; max-width: 1084px; }
.game-card, .panel { border: 1px solid var(--border); border-radius: 24px; background: #fff; box-shadow: 0 12px 40px rgba(18, 61, 107, .06); }
.game-card { padding: 24px; }
.game-tips { flex-shrink: 0; width: 100%; max-width: 1084px; margin-top: auto; padding: 18px 16px 0; border-top: 1px solid #eef2f8; color: #66758a; font-size: .9rem; line-height: 1.8; text-align: left; }
.game-tips p { margin: 0; }
.game-tips p + p { margin-top: 4px; }
.game-topbar { --score-card-height: 56px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "brand scores new" "hint hint hint"; align-items: center; gap: 6px 12px; margin-bottom: 16px; }
.game-brand { grid-area: brand; font-size: 44px; font-weight: 800; letter-spacing: -2px; line-height: 1.12; color: #246878; }
.scorecards { grid-area: scores; display: flex; gap: 8px; min-height: var(--score-card-height); }
.score-card { position: relative; min-width: 82px; padding: 6px 10px; border-radius: 10px; text-align: center; background: #eef5f7; }
.score-card > span:first-child { display: block; margin-bottom: 3px; font-size: 11px; line-height: 1.25; color: #7b919a; }
.score-card strong { display: block; font-size: 23px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.best-card { background: #e8f3f0; }
.best-card strong { color: #3c8276; }
.score-gain { position: absolute; right: 12px; bottom: -8px; color: #098f80; font-weight: 700; pointer-events: none; }
.game-topbar > .game-new-button { grid-area: new; justify-self: end; align-self: stretch; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 108px; padding: 8px 18px; min-height: var(--score-card-height); font-size: 15px; line-height: 1.25; white-space: nowrap; }
.game-new-button > span { font-size: 22px; line-height: 1; }
.game-actions { grid-area: hint; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 0; }
.game-tagline { color: var(--muted); font-size: 11px; line-height: 1.6; }
.game-actions p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.button { border: 0; border-radius: 9px; padding: 10px 17px; font-size: 13px; font-weight: 600; }
.primary { color: #fff; background: var(--primary); box-shadow: 0 3px 8px #087bb41a; }
.primary:hover { background: #0059b3; }
.secondary { background: #e9f0f2; color: #436170; }
.board-wrap { position: relative; }
.board { position: relative; width: 100%; aspect-ratio: 1; border-radius: 13px; padding: var(--gap); background: #9dbbb8; touch-action: none; user-select: none; -webkit-user-select: none; }
.board-background { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: var(--gap); height: 100%; }
.board-background > span { border-radius: 8px; background: #bed2cf; }
.tiles { position: absolute; inset: var(--gap); pointer-events: none; }
.tile { position: absolute; display: grid; place-items: center; width: calc((100% - 3 * var(--gap)) / 4); height: calc((100% - 3 * var(--gap)) / 4); left: calc(var(--col) * (100% + var(--gap)) / 4); top: calc(var(--row) * (100% + var(--gap)) / 4); border-radius: 8px; font-size: clamp(25px, 4vw, 43px); font-weight: 750; line-height: 1; color: #4d6b70; background: #edf4ed; }
.tile[data-value="4"] { background: #e0eddf; color: #517762; }
.tile[data-value="8"] { background: #b9dcc4; color: #386b50; }
.tile[data-value="16"] { background: #85c8b5; color: #fff; }
.tile[data-value="32"] { background: #55b3a9; color: #fff; }
.tile[data-value="64"] { background: #319c9a; color: #fff; }
.tile[data-value="128"] { background: #438eb2; color: #fff; }
.tile[data-value="256"] { background: #3973a1; color: #fff; }
.tile[data-value="512"] { background: #5c6eac; color: #fff; }
.tile[data-value="1024"] { background: #7e70ad; color: #fff; font-size: clamp(21px, 3.6vw, 34px); }
.tile[data-value="2048"] { background: #d5ac59; color: #fff; font-size: clamp(21px, 3.6vw, 34px); box-shadow: 0 0 20px #ebcf744d; }
.tile.large-tile { background: #466977; color: #fff; font-size: clamp(17px, 3vw, 28px); }
.board-caption { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; color: #8a9da4; font-size: 10px; }
kbd { display: inline-block; min-width: 18px; margin-right: 2px; padding: 2px 3px; border: 1px solid #e2eaec; border-bottom-width: 2px; border-radius: 4px; font-family: inherit; text-align: center; color: #69848e; }
.game-status { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 35px; margin-top: 10px; text-align: center; color: #769198; font-size: 11px; line-height: 1.7; }
.text-button { border: 0; background: transparent; color: var(--primary); padding: 0; font-size: 12px; white-space: nowrap; }
.direction-pad { margin-top: 5px; text-align: center; }
.direction-pad button { width: 35px; height: 30px; margin: 2px; border: 1px solid #dfebed; border-radius: 6px; background: #f4f8f9; color: #577a86; }
.direction-pad button:hover { background: #e4f0f3; }
.side-column { display: grid; grid-template-rows: auto minmax(min-content, 1fr); gap: 20px; min-width: 0; }
.panel { padding: 24px; }
.leaderboard-panel { padding: 20px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-kicker { display: block; font-size: 10px; }
.panel h2 { margin: 0; font-size: 19px; letter-spacing: -.4px; }
.trophy { color: #c7a75d; margin-right: 5px; font-size: 25px; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--border); background: #fff; border-radius: 8px; color: #79929a; font-size: 21px; }
.ranking-labels { display: flex; justify-content: space-between; margin-top: 22px; padding: 0 8px 11px; border-bottom: 1px solid #eef2f3; color: #93a3ab; font-size: 10px; }
/* Keep the leaderboard scrollbar visible inside the toolbox iframe as well. */
.leaderboard-scroll { height: 264px; max-height: 264px; overflow-y: scroll; overscroll-behavior: contain; scrollbar-width: thin !important; -ms-overflow-style: auto !important; scrollbar-color: #b3ced0 #f4f8f9; scrollbar-gutter: stable; }
.leaderboard-scroll::-webkit-scrollbar { display: block !important; width: 5px !important; height: 5px !important; }
.leaderboard-scroll::-webkit-scrollbar-track { background: #f4f8f9; }
.leaderboard-scroll::-webkit-scrollbar-thumb { background: #b3ced0; border-radius: 5px; }
.leaderboard { list-style: none; padding: 0; margin: 0; }
.rank-row { display: flex; align-items: center; gap: 10px; height: 36px; min-height: 36px; padding: 4px 8px; border-bottom: 1px solid #f1f5f5; }
.rank-row.is-me { background: #edf7f5; border-radius: 8px; }
.rank-number { flex: 0 0 23px; text-align: center; color: #94a6ae; font-size: 12px; font-weight: 700; }
.rank-row:nth-child(1) .rank-number { color: #b28c37; }
.rank-row:nth-child(2) .rank-number { color: #79929f; }
.rank-row:nth-child(3) .rank-number { color: #b4856f; }
.rank-avatar { display: grid; place-items: center; flex: 0 0 27px; height: 27px; border-radius: 50%; background: #eaf2f5; color: #6d929f; font-size: 11px; }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.rank-score { font-size: 13px; color: #456977; font-variant-numeric: tabular-nums; }
.list-status { margin: 12px 8px; text-align: center; color: #90a2ab; font-size: 12px; line-height: 1.7; }
.load-more { min-height: 36px; width: 100%; margin: 9px 0 2px; padding: 8px; border: 1px solid #e0ebed; border-radius: 8px; color: #618391; background: #f7fafb; font-size: 12px; }
.panel-note { margin: 14px 0 0; padding-top: 13px; border-top: 1px solid #edf2f3; color: #93a5ac; font-size: 10px; text-align: center; }
.instructions h2 { margin-bottom: 22px; }
.instructions ol { list-style: none; margin: 0; padding: 0; }
.instructions li { display: flex; gap: 12px; margin-bottom: 19px; }
.step-number { flex: 0 0 27px; height: 27px; display: grid; place-items: center; background: #edf5f5; border-radius: 8px; color: #749ca1; font-size: 10px; }
.instructions strong { font-size: 12px; font-weight: 600; }
.instructions li p { margin: 5px 0 0; font-size: 11px; color: #8a9ca5; line-height: 1.8; }
.merge-example { display: flex; justify-content: center; align-items: center; gap: 13px; padding: 13px; background: #f6f9f9; border-radius: 10px; }
.merge-example span { display: grid; place-items: center; width: 34px; height: 34px; background: #e0eddf; border-radius: 6px; color: #517762; font-size: 19px; font-weight: 700; }
.merge-example span:last-child { background: #bbdcca; }
.merge-example b { color: #9db2b8; font-size: 13px; font-weight: 400; }
.tip { margin: 17px 0 0; padding: 12px; border-left: 2px solid #92bcb7; border-radius: 0 7px 7px 0; color: #7d969a; background: #f3f8f6; font-size: 11px; line-height: 1.8; }
.tip strong { display: block; color: #4e837c; font-size: 11px; }
.game-overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; border-radius: 13px; background: rgba(241, 248, 245, .94); text-align: center; backdrop-filter: blur(5px); }
.overlay-symbol { font-size: 43px; color: #81a997; }
.game-overlay h2 { margin: 10px 0 5px; font-size: 28px; }
.game-overlay p { margin: 8px 0 22px; color: #78958f; line-height: 1.7; font-size: 13px; }
.overlay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
@media (max-width: 850px) { .game-layout, .game-tips { max-width: 560px; } .game-layout { grid-template-columns: 1fr; } .side-column { grid-template-columns: 1fr; grid-template-rows: auto auto; } .tile { font-size: 40px; } .tile[data-value="1024"], .tile[data-value="2048"] { font-size: 32px; } .tile.large-tile { font-size: 27px; } }
@media (max-width: 767.98px) { .game-header { padding: 4px 16px; gap: 10px; } .game-plan { padding: 5px 8px; font-size: .72rem; } .game-title { gap: 7px; font-size: 1.175rem; } .game-title-icon { width: 32px; height: 32px; font-size: 1.3rem; } .game-open-link { font-size: .8rem; } .game-page { padding: 24px 16px 16px; gap: 20px; } }
@media (max-width: 575.98px) { .game-header { grid-template-columns: minmax(0, 1fr) auto; } .game-title { grid-column: 1 / -1; grid-row: 1; } .game-plan { grid-column: 1; grid-row: 2; } .game-open-link { grid-column: 2; grid-row: 2; } .game-card, .panel { border-radius: 22px; } .game-tips { padding: 18px 12px 0; font-size: .8rem; } }
@media (max-width: 575.98px) { .game-topbar { --score-card-height: 44px; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand scores" "hint new"; gap: 6px 10px; margin-bottom: 12px; } .game-brand { font-size: 38px; } .scorecards { gap: 6px; } .score-card { min-width: 69px; padding: 5px 9px; } .score-card > span:first-child { margin-bottom: 2px; font-size: 10px; } .score-card strong { font-size: 20px; } .game-tagline { display: none; } .game-actions p { font-size: 10px; line-height: 1.4; } }
@media (max-width: 420px) { :root { --gap: 9px; } .game-page { padding: 20px 12px 16px; } .game-card { padding: 18px; } .panel { padding: 20px; } .tile { font-size: 32px; } .tile[data-value="1024"], .tile[data-value="2048"] { font-size: 26px; } .tile.large-tile { font-size: 22px; } .board-caption { flex-wrap: wrap; font-size: 9px; } }

.game-sound-caption { flex-wrap: wrap; }
.game-sound-toggle { margin-left: auto; padding: 6px 10px; min-height: 30px; font-size: 11px; white-space: nowrap; }
