/* SUMTILO's mosaic tray. All presentation stays local to this game. */
.sumtilo-page {
  --sumtilo-tile-0: #25b5f5;
  --sumtilo-tile-1: #78dc46;
  --sumtilo-tile-2: #ffcc32;
  --sumtilo-tile-3: #ff9b83;
  --sumtilo-tile-4: #b9a2f2;
  --sumtilo-tile-5: #55d9c2;
  --sumtilo-tile-6: #ffb05c;
  --sumtilo-tile-7: #6fd4ee;
  --sumtilo-tile-8: #d9e86b;
  --sumtilo-tile-9: #e9b1d1;
  --sumtilo-tile-10: #87b6fa;
  --sumtilo-tile-11: #f3db89;
  --sumtilo-tile-12: #9ddda8;
  --sumtilo-tile-13: #d3a4ea;
  --sumtilo-tile-14: #f8ba9a;
  --sumtilo-tile-15: #9dd4cc;
  --sumtilo-board: #faf6e9;
  --sumtilo-grid-border: #bcc6c9;
  --sumtilo-selection: #b8e0ff;
  --sumtilo-cell-hover: #e6f2f6;
  --sumtilo-navy: #102b49;
}
.sumtilo-page main { padding: 22px 28px; }
.sumtilo-page .content { max-width: 960px; margin-inline: auto; }
.sumtilo-page .page-heading { grid-template-columns: minmax(0,1fr) minmax(250px,42%); align-items: center; margin-bottom: 18px; }
.sumtilo-page .sumtilo-title { width: 330px; }
.sumtilo-page .game-heading h1 { margin-bottom: 6px; }
.sumtilo-page .game-heading p { color: #405b7b; }
.sumtilo-page .game-heading p.desktop-only { margin-bottom: 0; }
.sumtilo-page .sumtilo-difficulty { height: 44px; margin-top: 0; border: 1px solid #c8d8eb; background: #e0ebf8; box-shadow: inset 0 1px 3px #48638b0a; }
.sumtilo-page .sumtilo-difficulty button { min-height: 42px; background: transparent; color: #243b5c; font-size: 14px; }
.sumtilo-page .sumtilo-difficulty button[aria-pressed="true"] { background: linear-gradient(#ffffff30,transparent 42%),var(--difficulty-active); border: 1px solid var(--difficulty-active); box-shadow: inset 0 1px 1px #ffffffa6,0 2px 4px #17375414; color: var(--difficulty-active-text); }
.sumtilo-page .sumtilo-difficulty button[data-difficulty="medium"] { --difficulty-active: #ffd34b; --difficulty-active-text: #17263e; }
.sumtilo-page .game-card { padding: 22px 24px 14px; background: linear-gradient(135deg,#fffefa,#faf9f5); border-color: #dce5e9; border-radius: 22px; box-shadow: 0 12px 32px #234c7410,inset 0 1px 0 #fff; }
.sumtilo-page .puzzle-header { min-height: 48px; align-items: center; }
.sumtilo-page .puzzle-header > div:first-child { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 18px; }
.sumtilo-page .puzzle-header h2 { margin: 0; font-size: 23px; }
.sumtilo-page .puzzle-header p { font-size: 15px; color: #506583; }
.sumtilo-page .puzzle-tools { gap: 14px; }
.sumtilo-page .timer-control { gap: 10px; padding: 0 0 0 12px; height: 46px; border: 1px solid #e0e6ee; background: linear-gradient(#f7f9fc,#eaf0f6); }
.sumtilo-page .timer-control #pause { min-height: 44px; border-color: #d5dfe9; background: linear-gradient(#fff,#edf1f5); box-shadow: 0 2px 3px #213b5b16,inset 0 1px 0 #fff; }
.sumtilo-page .help-controls { gap: 12px; padding-left: 14px; }
.sumtilo-page .help-controls button { min-width: 44px; min-height: 44px; padding: 7px; border: 0; border-radius: 10px; }
.sumtilo-page .help-controls #show-solution { padding: 8px 12px; border: 1px solid #d7e0e9; background: linear-gradient(#fff,#f0f3f6); box-shadow: 0 2px 4px #213b5b0d; }
.sumtilo-page .help-controls #sound-toggle { color: #315579; border-radius: 10px; }
.sumtilo-page .help-controls #sound-toggle[aria-pressed="true"] { background: #e5edf5; }
.sumtilo-page .help-controls #sound-toggle:hover:not(:disabled) { background: #dbe7f3; }
.sumtilo-page .help-controls #sound-toggle:disabled { opacity: .5; }
.sumtilo-page .puzzle-header > div:first-child { min-width: 0; }
.sumtilo-page #board {
  width: min(100%,568px,calc(clamp(320px,calc(100svh - 350px),560px) * var(--board-ratio,1) + 28px));
  margin: 16px auto 18px;
  padding: 12px;
  border: 2px solid #0c223d;
  border-radius: 23px;
  background: linear-gradient(130deg,#3a6b8a 0%,#183858 28%,#102b49 72%,#355873 100%);
  box-shadow: inset 0 2px 2px #b8e5ff8c,inset 0 -3px 2px #061b33a6,0 5px 7px #0a203926,0 14px 24px #1634501c;
}
.sumtilo-page .sumtilo-surface { position: relative; isolation: isolate; border: 2px solid #081c32; border-radius: 10px; overflow: hidden; background: var(--sumtilo-board); box-shadow: 0 1px 1px #c6edff66; }
.sumtilo-page #sumtilo-pieces { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.sumtilo-page .sumtilo-piece { position: absolute; border: 2px solid #15345945; border-radius: 9px; background: linear-gradient(135deg,#ffffff36,transparent 45%,#00324b13),var(--piece-color); box-shadow: inset 2px 3px 2px #ffffffa1,inset -3px -4px 3px #06365438,inset 0 0 0 4px #ffffff14,0 2px 3px #102b4933; }
.sumtilo-page .play-grid { position: relative; z-index: 1; border: 0; background: transparent; }
.sumtilo-page .play-grid:empty { aspect-ratio: 1; background: repeating-linear-gradient(to right,transparent 0 calc(16.666% - 1px),var(--sumtilo-grid-border) calc(16.666% - 1px) 16.666%),repeating-linear-gradient(to bottom,var(--sumtilo-board) 0 calc(16.666% - 1px),var(--sumtilo-grid-border) calc(16.666% - 1px) 16.666%); }
.sumtilo-page .grid-cell { border: .5px solid #405c742b; background: linear-gradient(135deg,#fffdf5,#f5efdf); color: #102543; font-size: clamp(23px,2.7vw,32px); font-weight: 700; text-shadow: 0 1px 0 #ffffff40; }
.sumtilo-page .grid-cell.region { background: transparent !important; border: .5px solid #173b5a22 !important; }
.sumtilo-page .grid-cell:hover:not(:disabled) { background: var(--sumtilo-cell-hover); }
.sumtilo-page .grid-cell.region:hover:not(:disabled) { background: #ffffff1f !important; }
.sumtilo-page .grid-cell:focus-visible { outline: 3px solid #082f60; outline-offset: -5px; box-shadow: inset 0 0 0 5px #ffffffb3; }
.sumtilo-page .grid-cell.selection { box-shadow: none; background: #a9d9ff52 !important; }
.sumtilo-page #sumtilo-selection { position: absolute; z-index: 2; pointer-events: none; border: 3px solid #125aac; border-radius: 5px; box-shadow: inset 0 0 0 2px #fff9,0 0 0 1px #fff9; }
.sumtilo-page .play-grid.delete-active .grid-cell { color: #a31516; }
.sumtilo-page #board.paused .sumtilo-surface { visibility: hidden; }
.sumtilo-page .pause-screen { inset: 12px; background: linear-gradient(135deg,#fffdf5,#f5efdf); border-color: #0c223d; }
.sumtilo-page .toolbar { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.sumtilo-page .toolbar button { flex-direction: row; gap: 10px; min-height: 54px; padding: 10px 12px; border: 1px solid #d2dce7; border-radius: 13px; background: linear-gradient(#fff,#edf2f7); color: #182e50; box-shadow: inset 0 1px 0 #fff,0 2px 4px #1a3b5b10; }
.sumtilo-page .toolbar button:disabled { color: #78879b; box-shadow: none; }
.sumtilo-page .toolbar #new-puzzle { color: #fff; border-color: #0060dd; background: linear-gradient(#229dff,#0068ed 65%,#0052ce); box-shadow: inset 0 2px 0 #ffffff70,0 3px 6px #0062d52b; }
.sumtilo-page .toolbar #new-puzzle:disabled { opacity: .6; }
.sumtilo-page .toolbar #delete-mode[aria-pressed="true"] { background: linear-gradient(#c8392d,#a92019); color: #fff; border-color: #a92019; }
.sumtilo-page .toolbar button:hover:not(:disabled) { filter: brightness(.97); }
.sumtilo-page .toolbar button:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 1px 3px #20374c1a; }
.sumtilo-page .extra-actions { margin-top: 8px; gap: 4px; justify-content: flex-end; }
.sumtilo-page .extra-actions button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; gap: 6px; padding: 6px 10px; background: transparent; color: #4b6280; font-size: 12px; }
.sumtilo-page .extra-actions .icon { width: 17px; height: 17px; }
.sumtilo-page .extra-actions button:disabled { color: #8695a9; }
.sumtilo-page .extra-actions button:hover:not(:disabled) { background: #e7eef6; }
.sumtilo-page .extra-actions button[aria-pressed="true"] { background: #dbeafe; color: #0642b8; }
.sumtilo-page #status { min-height: 18px; margin: 0 0 10px; font-size: 12px; text-align: center; }
.sumtilo-page .statistics { position: relative; margin: 0; border: 0; border-top: 1px solid #dce3e8; border-radius: 0; overflow: visible; background: transparent; }
.sumtilo-page .statistics .scoreboard { padding: 14px 140px 8px 0; grid-template-columns: repeat(3,minmax(0,1fr)); }
.sumtilo-page .statistics .scoreboard > div { display: block; padding: 0 18px; border-top: 0; }
.sumtilo-page .statistics .scoreboard dt { font-size: 12px; color: #506583; }
.sumtilo-page .statistics .scoreboard dd { margin: 4px 0 0; font-size: 23px; text-align: left; color: #112c4c; }
.sumtilo-page .statistics #total-points.not-saved { font-size: 13px; }
.sumtilo-page .sumtilo-statistics-details > summary { position: absolute; top: 14px; right: 0; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 12px; list-style: none; color: #263f60; border-radius: 9px; cursor: pointer; }
.sumtilo-page .sumtilo-statistics-details > summary::-webkit-details-marker { display: none; }
.sumtilo-page .sumtilo-statistics-details > summary:hover { background: #e9eff5; }
.sumtilo-page .sumtilo-statistics-details > summary .icon { width: 18px; height: 18px; }
.sumtilo-page .sumtilo-statistics-details > summary .icon-chevron { width: 14px; height: 14px; }
.sumtilo-page .sumtilo-statistics-details[open] > summary .icon-chevron { transform: rotate(90deg); }
.sumtilo-page .sumtilo-statistics-content { margin-top: 12px; border: 1px solid #dce5ed; border-radius: 14px; overflow: hidden; background: #ffffffa6; }
.sumtilo-page .statistics .game-bonuses { padding: 16px; }
.sumtilo-page .statistics .game-bonuses .local-summary > div { background: #edf3f8; }
.sumtilo-page .statistics .game-bonuses .local-summary dd { font-size: 22px; }
.sumtilo-page .statistics .game-bonuses #stage-bonus-progress { font-size: 16px; }
.sumtilo-page .statistics .stats-option { margin: 0; padding: 12px 20px; }
.sumtilo-page .statistics .storage-language-note { margin: 0; padding: 0 20px 16px; }
.sumtilo-page .statistics .statistics-footer { padding: 12px 20px; }
.sumtilo-page .puzzle-reference { margin-top: 8px; }
.sumtilo-page.focus-mode main { width: min(1016px,100%); }
.sumtilo-page #game-shell:fullscreen { display: block; padding: 20px max(20px,calc((100vw - 920px) / 2)); background: #faf9f5; }

/* An opaque medal card appears as soon as completion is confirmed. */
.sumtilo-page .game-reward {
  width: min(calc(100% - 32px),360px);
  padding: 44px 22px 18px;
  border: 3px solid #ce951f;
  border-radius: 19px;
  background: linear-gradient(135deg,#fffef9,#fbf5e7);
  color: #102543;
  box-shadow: inset 0 0 0 2px #fff2bb,inset 0 -3px 2px #b77d1726,0 3px 0 #93651b,0 10px 22px #071b3d55;
  animation: sumtilo-medal-arrive 260ms ease-out both;
}
.sumtilo-page .reward-medal { position: absolute; top: -40px; left: 50%; transform: translateX(-50%); display: grid; place-items: center; width: 76px; height: 76px; border: 2px solid #c38a16; border-radius: 50%; background: linear-gradient(135deg,#fff5b0 0%,#ffe176 32%,#efb82b 63%,#c78a16 100%); box-shadow: inset 0 0 0 3px #fff2b6,inset 0 -4px 3px #a9681b55,0 4px 7px #58411b40; }
.sumtilo-page .reward-medal::before { content: ""; position: absolute; inset: 7px; border: 1px solid #bb8115; border-radius: 50%; box-shadow: 0 1px 0 #fff7cb; }
.sumtilo-page .reward-medal .icon { width: 38px; height: 38px; stroke-width: 3.5; color: #123552; filter: drop-shadow(0 1px 0 #fff2b6); }
.sumtilo-page .game-reward strong { margin-bottom: 14px; color: #102543; font-size: clamp(24px,4vw,34px); line-height: 1.12; text-transform: none; text-shadow: none; }
.sumtilo-page .game-reward dl { font-size: 16px; line-height: 1.4; }
.sumtilo-page .game-reward dl > div { margin-top: 0; padding: 9px 0; border-top: 1px solid #dedbcf; }
.sumtilo-page .game-reward dd { flex: 0 0 auto; }
.sumtilo-page .game-reward .reward-total { align-items: center; gap: 6px; margin-top: 12px; padding: 10px 12px; border: 1px solid #d3a136; border-radius: 11px; background: linear-gradient(135deg,#fff0b0,#ffdd7b 65%,#f4ca62); box-shadow: inset 0 1px 1px #fffce1,0 2px 2px #9b74201c; font-size: 18px; }
@keyframes sumtilo-medal-arrive {
  from { opacity: 0; transform: translate(-50%,calc(-50% + 10px)) scale(.98); }
  to { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .sumtilo-page .game-reward { animation: none; }
}
@media (max-width: 599px) {
  .sumtilo-page .game-reward { padding: 30px 12px 12px; border-width: 2px; border-radius: 15px; }
  .sumtilo-page .reward-medal { top: -29px; width: 54px; height: 54px; }
  .sumtilo-page .reward-medal::before { inset: 5px; }
  .sumtilo-page .reward-medal .icon { width: 28px; height: 28px; }
  .sumtilo-page .game-reward strong { margin-bottom: 10px; font-size: 24px; }
  .sumtilo-page .game-reward dl { font-size: clamp(12px,3.4vw,15px); }
  .sumtilo-page .game-reward dl > div { padding-block: 7px; }
  .sumtilo-page .game-reward .reward-total { margin-top: 8px; padding: 8px; font-size: 15px; }
}

@media (max-width: 1199px) and (min-width: 1000px) {
  .sumtilo-page main { padding-inline: 20px; }
  .sumtilo-page .page-heading { grid-template-columns: 1fr; gap: 14px; }
  .sumtilo-page .sumtilo-difficulty { width: 100%; }
  .sumtilo-page .game-card { padding-inline: 18px; }
  .sumtilo-page .puzzle-header > div:first-child { display: block; }
  .sumtilo-page .puzzle-tools { gap: 8px; }
  .sumtilo-page .help-controls { gap: 4px; padding-left: 8px; }
}
@media (max-width: 999px) {
  .sumtilo-page main { padding: 0 12px 20px; }
  .sumtilo-page .content { max-width: 760px; }
  .sumtilo-page .page-heading { grid-template-columns: 1fr; gap: 18px; padding: 20px 6px 18px; }
  .sumtilo-page .sumtilo-title { width: 280px; }
  .sumtilo-page .game-card { padding: 16px 14px 12px; border-radius: 18px; }
  .sumtilo-page .puzzle-header { padding: 0; }
  .sumtilo-page .puzzle-header > div:first-child { display: block; }
  .sumtilo-page .puzzle-header h2 { font-size: 20px; margin-bottom: 4px; }
  .sumtilo-page .puzzle-tools { flex-direction: row; gap: 10px; }
  .sumtilo-page #board { width: min(100%,548px); margin-block: 18px; }
  .sumtilo-page .toolbar button { font-size: 12px; gap: 6px; padding: 8px; }
}
@media (max-width: 599px) {
  .sumtilo-page .page-heading { gap: 16px; padding-top: 18px; }
  .sumtilo-page .sumtilo-title { width: 260px; }
  .sumtilo-page .game-card { padding: 14px 10px 10px; }
  .sumtilo-page .puzzle-header { align-items: flex-start; }
  .sumtilo-page .puzzle-header h2 { font-size: 18px; }
  .sumtilo-page .puzzle-header p { font-size: 13px; }
  .sumtilo-page .puzzle-tools { flex-direction: column; align-items: flex-end; gap: 5px; }
  .sumtilo-page .timer-control { height: 46px; padding-left: 9px; gap: 7px; border-radius: 10px; }
  .sumtilo-page .timer-control #pause { min-width: 44px; min-height: 44px; border-radius: 9px; }
  .sumtilo-page #timer { font-weight: 600; }
  .sumtilo-page .help-controls { gap: 4px; padding: 0; }
  .sumtilo-page .help-controls #show-solution { min-height: 44px; padding: 4px 8px; border: 0; box-shadow: none; background: transparent; }
  .sumtilo-page .help-controls #puzzle-help { min-height: 44px; min-width: 44px; }
  .sumtilo-page #board { padding: 9px; border-radius: 18px; margin-top: 12px; }
  .sumtilo-page .sumtilo-surface { border-radius: 7px; }
  .sumtilo-page .sumtilo-piece { border-radius: 6px; box-shadow: inset 1px 2px 2px #ffffffa1,inset -2px -3px 2px #06365438,inset 0 0 0 3px #ffffff14; }
  .sumtilo-page .grid-cell { font-size: 24px; }
  .sumtilo-page .toolbar { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .sumtilo-page .toolbar button { min-height: 48px; font-size: 12px; padding: 8px 6px; }
  .sumtilo-page .toolbar .icon { width: 19px; height: 19px; }
  .sumtilo-page .extra-actions { justify-content: space-between; gap: 0; margin-top: 6px; }
  .sumtilo-page .extra-actions button { font-size: 11px; padding: 6px; gap: 4px; }
  .sumtilo-page .extra-actions .icon { width: 15px; height: 15px; }
  .sumtilo-page .statistics .scoreboard { padding: 14px 0 10px; }
  .sumtilo-page .statistics .scoreboard > div { padding: 0 8px; }
  .sumtilo-page .statistics .scoreboard dt { font-size: 11px; }
  .sumtilo-page .statistics .scoreboard dd { font-size: 21px; }
  .sumtilo-page .statistics #total-points.not-saved { font-size: 12px; }
  .sumtilo-page .sumtilo-statistics-details > summary { position: static; justify-content: flex-end; min-height: 44px; padding: 6px 8px; }
  .sumtilo-page .statistics .game-bonuses { padding: 10px; }
  .sumtilo-page .statistics .game-bonuses .local-summary { grid-template-columns: 1fr; }
  .sumtilo-page .statistics .stats-option { padding: 12px; font-size: 12px; }
  .sumtilo-page .statistics .stats-option input { flex: 0 0 18px; }
  .sumtilo-page .statistics .storage-language-note { padding-inline: 12px; }
}
