﻿:root {
  --bg: #f2f2f2;
  --panel: #ffffff;
  --header: #f8981d;
  --toolbar: #111111;
  --line: #1f1f1f;
  --soft-line: #b8b8b8;
  --selected: #ffba52;
  --given: #eef8ff;
  --error: #cf2e2e;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 10%, #fcfcfc 0%, #eeeeee 45%, #e7e7e7 100%);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: #111;
}

#main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.kubok-header {
  background: var(--header);
  color: #fff;
  text-align: center;
  position: relative;
  padding: 10px 76px;
  letter-spacing: 0.03em;
}

.kubok-title {
  display: block;
  font-size: 42px;
  font-weight: 700;
  line-height: 1.1;
}

.kubok-toolbar {
  background: var(--toolbar);
  color: #fff;
  font-weight: 700;
  padding: 8px 10px;
}

.toolbar-item {
  margin: 4px 18px;
}

#difficulty-label {
  text-transform: capitalize;
  margin-left: 6px;
  color: #ffca7d;
}

#timer {
  min-width: 64px;
  display: inline-block;
}

.container-checkbox {
  position: relative;
  cursor: pointer;
  margin: 0;
  font-size: 14px;
  user-select: none;
  padding-left: 0;
}

.container-checkbox input {
  position: absolute;
  opacity: 0;
  height: 0;
  width: 0;
}

.checkmark {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 8px;
  background: #fff;
  border: 1px solid #7a7a7a;
  position: relative;
}

.container-checkbox input:checked ~ .checkmark {
  background: #11bf35;
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.container-checkbox input:checked ~ .checkmark:after {
  display: block;
}

.error-label {
  vertical-align: middle;
}

.game-shell {
  padding-top: 18px;
}

.game-container {
  max-width: 540px;
  margin: 0 auto;
  padding: 8px 10px 8px;
  position: relative;
  min-height: auto !important;
}

.board-stage {
  width: 408px;
  height: 392px;
  margin: 0 auto;
  position: relative;
}

.note-column {
  width: 72px;
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.note-column-1 {
  left: 141px;
  top: 0;
}

.note-column-2 {
  left: 267px;
  top: 0;
}

.note-column-3 {
  left: 78px;
  top: 320px;
}

.note-column-4 {
  left: 204px;
  top: 320px;
}

.note-column-5 {
  left: 330px;
  top: 320px;
}

.note-slot {
  height: 18px;
  line-height: 18px;
  font-size: 15px;
  text-align: center;
  font-weight: 700;
  color: #1e1e1e;
  border: 1px solid var(--soft-line);
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.zigzag-board {
  --big-size: 116px;
  --big-half: 58px;
  --top-row-top: 24px;
  --bottom-row-top: calc(var(--top-row-top) + var(--big-half));
  --sum-size: 40px;
  --sum-half: 20px;
  --x1: 83px;
  --x2: 209px;
  --x3: 20px;
  --x4: 146px;
  --x5: 272px;
  --gap-top-center-x: calc((var(--x1) + var(--big-size) + var(--x2)) / 2);
  --gap-bottom-left-center-x: calc((var(--x3) + var(--big-size) + var(--x4)) / 2);
  --gap-bottom-right-center-x: calc((var(--x4) + var(--big-size) + var(--x5)) / 2);
  width: 408px;
  height: 230px;
  margin: 0;
  left: 0;
  top: 78px;
  position: relative;
}

.big-circle {
  width: var(--big-size);
  height: var(--big-size);
  border-radius: 50%;
  border: 2px solid var(--line);
  position: absolute;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 68px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.zz15-cell:nth-child(odd) {
  padding-top: 13px !important;
}

.zz15-cell:nth-child(even) {
  padding-bottom: 13px !important;
}

.big-circle .cell-value {
  position: relative;
  z-index: 8;
}

.big-circle:hover {
  background: #f9fbfd;
}

.game-cell-1 {
  left: var(--x1);
  top: var(--top-row-top);
}

.game-cell-2 {
  left: var(--x2);
  top: var(--top-row-top);
}

.game-cell-3 {
  left: var(--x3);
  top: var(--bottom-row-top);
}

.game-cell-4 {
  left: var(--x4);
  top: var(--bottom-row-top);
}

.game-cell-5 {
  left: var(--x5);
  top: var(--bottom-row-top);
}

.board-separators {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.board-separators line {
  stroke: #a8a8a8;
  stroke-width: 1.25;
  opacity: 1;
  stroke-linecap: round;
}

.board-separators .zigzag-path {
  fill: none;
  stroke: #a8a8a8;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
}

.board-separators .intersection-cut-path {
  fill: none;
  stroke: #fff;
  stroke-width: 33;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.board-separators .intersection-cut {
  fill: #fff;
  stroke: none;
}

.sum-circle {
  width: var(--sum-size);
  height: var(--sum-size);
  border-radius: 50%;
  background: #000;
  color: #fff;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  z-index: 12;
  pointer-events: none;
}

.sum-value {
  position: relative;
  z-index: 13;
  transform: translateY(-1px);
}

.cell-sum-1 {
  left: calc(var(--gap-top-center-x) - var(--sum-half));
  top: calc(var(--top-row-top) + var(--big-half) - var(--sum-half));
}

.cell-sum-2 {
  left: calc(var(--gap-bottom-left-center-x) - var(--sum-half));
  top: calc(var(--bottom-row-top) + var(--big-half) - var(--sum-half));
}

.cell-sum-3 {
  left: calc(var(--gap-bottom-right-center-x) - var(--sum-half));
  top: calc(var(--bottom-row-top) + var(--big-half) - var(--sum-half));
}

.kubok-game-value {
  background: #fff;
  color: #1e1e1e;
}

.kubok-user-value {
  background: #fff;
}

.kubok-cell-selected {
  box-shadow: 0 0 0 4px var(--selected) inset;
}

.kubok-hint-cell-selected {
  border-color: var(--selected);
  box-shadow: 0 0 0 2px var(--selected);
}

.kubok-value-error {
  color: var(--error);
}

.kubok-current-mode {
  border: 3px solid var(--selected) !important;
  background: #d6d6d6 !important;
}

.overlay-wrapper {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.62);
  z-index: 20;
}

.keypad-wrapper {
  max-width: 420px;
  margin: 12px auto 0;
  background: #dfdfdf;
  margin-bottom: 30px;
  width: fit-content;
}

.gamecontrols {
  width: 50px;
  height: 50px;
  background: #e6e6e6;
  color: #000;
  border-color: #8f8f8f;
  font-weight: 800;
}

.gamecontrols-undo:hover {
  background: #555 !important;
}

.gamecontrols-undo svg {
  padding-right: 7px;
  padding-top: 4px;
}

.numpad:hover {
  background: #555 !important;
}

.gamecontrols .svg-wrapper svg,
.icon-game-control {
  width: 25px;
  height: 25px;
}

.btn.btn-outline-dark.btn-lg {
  min-width: 50px;
  min-height: 50px;
  font-size: 1.4rem;
  line-height: 1;
  font-weight: 700;
  background: #f6f6f6;
  border-color: #8f8f8f;
}

.kubok-modal-content {
  background: #5aaeea;
  color: #fff;
}

.kubok-success-message {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
}

.time-elapsed {
  text-align: center;
  font-size: 20px;
  color: #fff;
  font-weight: 700;
  margin-bottom: 20px;
}

.kubok-help-content {
  background: #212121;
  color: #fff;
}

.help-rules-stack {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.help-rules-panel {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  padding: 14px;
}

.help-rules-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
}

.help-rules-list {
  margin: 0;
  padding-left: 20px;
  color: #f0f0f0;
}

.help-rules-list li {
  margin-bottom: 6px;
  line-height: 1.35;
  font-size: 14px;
}

.help-board-preview {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.help-preview-canvas {
  position: relative;
  width: 100%;
  min-height: 340px;
  background: #f6f6f6;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  overflow: hidden;
}

.help-preview-canvas .zz15-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 1040px;
  height: 392px;
  pointer-events: none;
}

.preview-stage {
  width: 300px;
  height: 332px;
  position: relative;
  margin: 0 auto;
}

.preview-note-column {
  width: 66px;
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.preview-note-column-1 { left: 104px; top: 0; }
.preview-note-column-2 { left: 196px; top: 0; }
.preview-note-column-3 { left: 57px; top: 270px; }
.preview-note-column-4 { left: 150px; top: 270px; }
.preview-note-column-5 { left: 242px; top: 270px; }

.preview-note-slot {
  min-height: 18px;
  height: 18px;
  line-height: 18px;
  border: 1px solid #9d9d9d;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.preview-zigzag-board {
  --big-size: 85px;
  --big-half: 42.5px;
  --top-row-top: 17px;
  --bottom-row-top: calc(var(--top-row-top) + var(--big-half));
  --sum-size: 22px;
  --sum-half: 11px;
  --x1: 61px;
  --x2: 154px;
  --x3: 15px;
  --x4: 107px;
  --x5: 200px;
  --gap-top-center-x: calc((var(--x1) + var(--big-size) + var(--x2)) / 2);
  --gap-bottom-left-center-x: calc((var(--x3) + var(--big-size) + var(--x4)) / 2);
  --gap-bottom-right-center-x: calc((var(--x4) + var(--big-size) + var(--x5)) / 2);
  width: 300px;
  min-height: 18px;
  min-height: 18px;
  height: 18px;
  line-height: 18px;
  left: 0;
  top: 70px;
}

.preview-big {
  position: absolute;
  border-radius: 50%;
  width: var(--big-size);
  height: var(--big-size);
  border: 2px solid #1f1f1f;
  background: #fff;
  z-index: 1;
}

.preview-cell-1 { left: var(--x1); top: var(--top-row-top); }
.preview-cell-2 { left: var(--x2); top: var(--top-row-top); }
.preview-cell-3 { left: var(--x3); top: var(--bottom-row-top); }
.preview-cell-4 { left: var(--x4); top: var(--bottom-row-top); }
.preview-cell-5 { left: var(--x5); top: var(--bottom-row-top); }

.preview-board-separators {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.preview-zigzag-path {
  fill: none;
  stroke: #a8a8a8;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.preview-intersection-cut-path {
  fill: none;
  stroke: #fff;
  stroke-width: 33;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.preview-intersection-cut {
  fill: #fff;
  stroke: none;
}

.preview-sum {
  width: var(--sum-size);
  height: var(--sum-size);
  border-radius: 50%;
  background: #000;
  color: #fff;
  position: absolute;
  z-index: 3;
  pointer-events: none;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.preview-sum-1 {
  left: calc(var(--gap-top-center-x) - var(--sum-half));
  top: calc(var(--top-row-top) + var(--big-half) - var(--sum-half));
}

.preview-sum-2 {
  left: calc(var(--gap-bottom-left-center-x) - var(--sum-half));
  top: calc(var(--bottom-row-top) + var(--big-half) - var(--sum-half));
}

.preview-sum-3 {
  left: calc(var(--gap-bottom-right-center-x) - var(--sum-half));
  top: calc(var(--bottom-row-top) + var(--big-half) - var(--sum-half));
}

.footer-copy {
  background: #fff;
  font-weight: 700;
  margin-top: auto !important;
  padding: 10px 15px 5px 15px !important;
}

.hc-nav-trigger {
  top: 20px;
  right: 20px;
}

.modal.show .modal-dialog {
  transform: translate(0, 0);
}

@media (orientation: landscape) and (min-width: 669px) and (max-width: 767px) {
  .col-md-auto {
    width: auto !important;
    margin: 0 auto;
  } 

  .game-shell.container {
    max-width: 100%;
    padding-left: 8px;
    padding-right: 8px;
  }

  .game-shell > .row {
    margin-left: 0;
    margin-right: 0;
  }

  .game-shell > .row > .col-12 {
    padding-left: 0;
    padding-right: 0;
  }

  .game-container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .board-stage.zz15-ready {
    max-width: calc(100vw - 16px);
  }
}

@media (orientation: landscape) and (min-width: 669px) and (max-width: 991px) {
  .zz15-help-column {
    width: var(--zz15-help-column-min-width) !important;
  }

  .zz15-help-box {
    gap: var(--zz15-help-separator-size) !important;
    padding: var(--zz15-help-separator-size) !important;
  }

  .zz15-help-box .zz15-help-digit:nth-child(3n) {
    border-right: var(--zz15-help-separator-size) solid var(--soft-line);
  }

  .zz15-help-box .zz15-help-digit {
    border-right: var(--zz15-help-separator-size) solid var(--soft-line);
  }
}

@media (max-width: 767px) {
  .col-md-auto {
    width: auto !important;
    margin: 0 auto;
  } 

  .kubok-header {
    padding: 12px 68px;
  }

  .kubok-title {
    font-size: 28px;
  }

  .hc-nav-trigger {
    top: 14px;
    right: 14px;
  }

  .toolbar-item {
    margin: 4px 8px;
  }

  .container-checkbox {
    font-size: 12px;
  }

  .game-container {
    max-width: 100%;
    padding: 12px 2px 8px;
  }

  .board-stage {
    width: 300px;
    height: 332px;
  }

  .note-column {
    width: 66px;
    gap: 3px;
  }

  .note-column-1 { left: 104px; top: 0; }
  .note-column-2 { left: 196px; top: 0; }
  .note-column-3 { left: 57px; top: 270px; }
  .note-column-4 { left: 150px; top: 270px; }
  .note-column-5 { left: 242px; top: 270px; }

  .zigzag-board {
    --big-size: 85px;
    --big-half: 42.5px;
    --top-row-top: 17px;
    --bottom-row-top: calc(var(--top-row-top) + var(--big-half));
    --sum-size: 30px;
    --sum-half: 15px;
    --x1: 61px;
    --x2: 154px;
    --x3: 15px;
    --x4: 107px;
    --x5: 200px;
    --gap-top-center-x: calc((var(--x1) + var(--big-size) + var(--x2)) / 2);
    --gap-bottom-left-center-x: calc((var(--x3) + var(--big-size) + var(--x4)) / 2);
    --gap-bottom-right-center-x: calc((var(--x4) + var(--big-size) + var(--x5)) / 2);
    width: 300px;
    height: 170px;
    top: 70px;
  }

  .big-circle {
    font-size: 52px;
  }

  .game-cell-1 { left: var(--x1); top: var(--top-row-top); }
  .game-cell-2 { left: var(--x2); top: var(--top-row-top); }
  .game-cell-3 { left: var(--x3); top: var(--bottom-row-top); }
  .game-cell-4 { left: var(--x4); top: var(--bottom-row-top); }
  .game-cell-5 { left: var(--x5); top: var(--bottom-row-top); }

  .board-separators line {
    stroke-width: 1.8;
  }

  .sum-circle { font-size: 16px; }

  .cell-sum-1 { left: calc(var(--gap-top-center-x) - var(--sum-half)); top: calc(var(--top-row-top) + var(--big-half) - var(--sum-half)); }
  .cell-sum-2 { left: calc(var(--gap-bottom-left-center-x) - var(--sum-half)); top: calc(var(--bottom-row-top) + var(--big-half) - var(--sum-half)); }
  .cell-sum-3 { left: calc(var(--gap-bottom-right-center-x) - var(--sum-half)); top: calc(var(--bottom-row-top) + var(--big-half) - var(--sum-half)); }

  .note-slot {
    min-height: 18px;
    height: 18px;
    line-height: 18px;
    font-size: 14px;
  }

  .btn.btn-outline-dark.btn-lg, .gamecontrols {
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    padding: 0px !important;
  }

  .gamecontrols-undo svg {
    padding-left: 4px;
    padding-top: 5px;
    padding-right: 0px;
  }

  .hint-cell {
    font-size: 14px;
    padding-right: 0px;
  }

  .cell-note-grid {
    padding: 0px 4px;
  }
}

@media (orientation: portrait) and (min-width: 768px) {
  .board-stage {
    width: 460px;
    height: 560px;
  }

  .zigzag-board {
    left: 26px;
    top: 140px;
    transform: rotate(90deg);
    transform-origin: 50% 50%;
  }

  .note-column-1 { left: 306px; top: 287px; }
  .note-column-2 { left: 306px; top: 161px; }
  .note-column-3 { left: 146px; top: 350px; }
  .note-column-4 { left: 146px; top: 224px; }
  .note-column-5 { left: 146px; top: 98px; }

  .zigzag-board .cell-value {
    display: inline-block;
    transform: rotate(-90deg);
  }

  .zigzag-board .sum-value {
    display: inline-block;
    transform: rotate(-90deg) translateY(-1px);
  }
  
  .zz15-cell:nth-child(odd) .cell-note-grid {
    padding-left: 7px !important;
  }

  .zz15-cell:nth-child(even) .cell-note-grid {
    padding-right: 12px !important;
    margin-top: -7px;
  }
}

@media (orientation: portrait) and (max-width: 767px) {
  .col-md-auto {
    width: auto !important;
    margin: 0 auto;
  } 

  .note-column {
    width: clamp(52px, 16vw, 56px);
  }

  .board-stage {
    width: 300px;
    height: 440px;
  }

  .zigzag-board {
    width: 300px;
    height: 170px;
    left: 10px;
    top: 120px;
    transform: rotate(90deg);
    transform-origin: 50% 50%;
  }

  .note-column-1 { left: 276px; top: 223px; }
  .note-column-2 { left: 276px; top: 130px; }
  .note-column-3 { left: 52px; top: 269px; }
  .note-column-4 { left: 52px; top: 176px; }
  .note-column-5 { left: 52px; top: 84px; }

  .zigzag-board .cell-value {
    display: inline-block;
    transform: rotate(-90deg);
  }

  .zigzag-board .sum-value {
    display: inline-block;
    transform: rotate(-90deg) translateY(-1px);
  }

  .zz15-cell:nth-child(odd) .cell-note-grid {
    padding-left: 3px !important;
    margin-top: 7px;
    margin-bottom: -9px;
  }

  .zz15-cell:nth-child(even) .cell-note-grid {
    padding-right: 11px !important;
    margin-top: -8px !important;
    margin-left: -8px;
    margin-bottom: 7px !important;
  }
}

/* ZigZag 15 layout */
.game-container {
  max-width: 1160px;
}

.board-stage.zz15-ready {
  width: 100%;
  max-width: 1040px;
  min-height: 392px;
  position: relative;
  margin: 0 auto;
}

.board-stage.zz15-ready .zz15-canvas {
  --zz15-help-digit-size: 18px;
  --zz15-help-digit-min-width: 22px;
  --zz15-help-column-min-width: 88px;
  --zz15-help-separator-size: 1px;
  --zz15-help-column-gap: 7px;
  position: absolute;
  left: 0;
  top: 0;
  width: 1040px;
  height: 392px;
  transform-origin: top left;
}

.zz15-notes-layer,
.zz15-board {
  position: absolute;
  inset: 0;
}

.zz15-board {
  pointer-events: none;
}

.zz15-board .zz15-cell {
  pointer-events: auto;
}

.zz15-separators {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.zz15-zigzag-path {
  fill: none;
  stroke: #a8a8a8;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
}

.zz15-intersection-cut-path {
  fill: none;
  stroke: #fff;
  stroke-width: 33;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zz15-separators .intersection-cut {
  fill: #fff;
  stroke: none;
}

.zz15-cell {
  position: absolute;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 68px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.zz15-cell .cell-value {
  position: relative;
  z-index: 8;
}

.zz15-cell:hover {
  background: #f9fbfd;
}

.kubok-cell-fixed {
  background: #fff;
}

.kubok-cell-error {
  color: var(--error);
}

.zz15-sum-circle {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #000;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  z-index: 12;
  pointer-events: none;
  margin-left:-5px;
}

.zz15-sum-circle .sum-value {
  position: relative;
  z-index: 13;
  transform: translateY(-1px);
}

.zz15-help-column {
  position: absolute;
  width: 88px;
  display: flex;
  flex-direction: column;
    gap: var(--zz15-help-separator-size);
    padding: var(--zz15-help-separator-size);
}

.zz15-help-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(var(--zz15-help-digit-min-width), 1fr));
  gap: 1px;
  padding: 1px;
  border: 1px solid var(--soft-line);
  border-radius: 3px;
  background: #d6d6d6;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

.zz15-help-digit {
  width: 100%;
  min-width: var(--zz15-help-digit-min-width);
  min-height: var(--zz15-help-digit-size);
  height: var(--zz15-help-digit-size);
  line-height: var(--zz15-help-digit-size);
  border: 0;
  border-radius: 2px;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  color: #1e1e1e;
  text-align: center;
  padding: 0;
  margin: 0;
  outline: none;
  box-sizing: border-box;
}

.zz15-help-digit:focus {
  box-shadow: inset 0 0 0 2px var(--selected);
}

.kubok-hint-selected {
  box-shadow: inset 0 0 0 2px var(--selected);
  background: rgba(68, 110, 175, 0.08);
}

.keypad-wrapper {
  max-width: 620px;
  width: fit-content;
}

.zz15-numpad-layout-portrait {
  display: none;
}

.btn.btn-outline-dark.btn-lg.numpad-double {
  padding-left: 6px;
  padding-right: 6px;
}

@media (orientation: portrait) {
  .zz15-numpad-layout-landscape {
    display: none;
  }

  .zz15-numpad-layout-portrait {
    display: table-row-group;
  }
}

@media (max-width: 767px) {
  .col-md-auto {
    width: auto !important;
    margin: 0 auto;
  } 

  .board-stage.zz15-ready {
    min-height: 300px;
    margin-top: -50px;
  }

  .board-stage.zz15-ready .zz15-canvas {
    transform-origin: top left;
  }

  .zz15-help-column {
    width: 72px;
    gap: 3px;
    display: grid;
    transform: scale(0.8);
    transform-origin: center center;
  }

  .zz15-help-box .zz15-help-digit:nth-child(3n) {
    border-right: var(--zz15-help-separator-size) solid var(--soft-line);
  }

  .zz15-help-box .zz15-help-digit {
    border-right: var(--zz15-help-separator-size) solid var(--soft-line);
  }

  .zz15-help-digit {
    min-width: var(--zz15-help-digit-min-width);
    min-height: var(--zz15-help-digit-size);
    height: var(--zz15-help-digit-size);
    line-height: var(--zz15-help-digit-size);
    font-size: 28px;
  }

  .zz15-cell {
    font-size: 62px;
  }

  .zz15-sum-circle {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
    z-index: 12;
    pointer-events: none;
    margin-left: -10px;
    margin-top: -10px;
  }

  .zz15-cell:nth-child(odd) {
    padding-top: 13px !important;
  }

  .zz15-cell:nth-child(even) {
    padding-bottom: 13px !important;
  }

  .keypad-wrapper {
    max-width: 100%;
    width: fit-content;
  }

  .zz15-cell:nth-child(odd) .cell-note-grid {
    padding-left: 9px;
    margin-top: 7px;
    margin-bottom: -9px;
  }

  .zz15-cell:nth-child(even) .cell-note-grid {
    padding-left: 11px !important;
    margin-top: -9px;
    margin-bottom: 3px;
  }
}

@media (orientation: landscape) and (max-width: 768px) {
.zz15-help-column {
    margin-left: -29px;
  }
}

@media (orientation: portrait) and (min-width: 768px) {
  .board-stage.zz15-ready {
    width: 100%;
    max-width: min(620px, calc(100vw - 24px));
    min-height: 620px;
    height: 620px;
  }

  .board-stage.zz15-ready .zz15-canvas {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(90deg) scale(0.96);
    transform-origin: center center;
  }

  .zz15-help-column {
    --zz15-help-column-gap: calc(var(--zz15-help-digit-min-width) * 0.23);
    width: max(182px, calc(var(--zz15-help-digit-min-width) * 6 + var(--zz15-help-column-gap) + 12px));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--zz15-help-column-gap);
    row-gap: 4px;
    transform: rotate(-90deg);
    transform-origin: center center;
  }

  .zz15-help-column.portrait-left .zz15-help-box:nth-child(1) { grid-column: 1; grid-row: 1; }
  .zz15-help-column.portrait-left .zz15-help-box:nth-child(2) { grid-column: 1; grid-row: 2; }
  .zz15-help-column.portrait-left .zz15-help-box:nth-child(3) { grid-column: 1; grid-row: 3; }
  .zz15-help-column.portrait-left .zz15-help-box:nth-child(4) { grid-column: 2; grid-row: 1; }
  .zz15-help-column.portrait-left .zz15-help-box:nth-child(5) { grid-column: 2; grid-row: 2; }

  .zz15-help-column.portrait-right .zz15-help-box:nth-child(1) { grid-column: 1; grid-row: 1; }
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(2) { grid-column: 1; grid-row: 2; }
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(3) { grid-column: 2; grid-row: 1; }
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(4) { grid-column: 2; grid-row: 2; }
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(5) { grid-column: 2; grid-row: 3; }

  .zz15-help-column.portrait-left .zz15-help-box:nth-child(4),
  .zz15-help-column.portrait-left .zz15-help-box:nth-child(5),
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(1),
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(2) {
    transform: translateY(calc(50% + 2px));
  }

  .zz15-help-box .zz15-help-digit:nth-child(3n) {
    border-right: var(--zz15-help-separator-size) solid var(--soft-line);
  }

  .zz15-help-box .zz15-help-digit {
    border-right: var(--zz15-help-separator-size) solid var(--soft-line);
  }

  .help-preview-canvas {
   min-height: 420px;
  }

  .help-preview-canvas .zz15-canvas {
    position: absolute;
    width: 1040px;
    height: 392px;
    pointer-events: none;
    margin-top: 0px;
    transform: rotate(90deg) scale(0.40) translate(-50%, -50%) !important;
  }

  .zz15-cell .cell-value,
  .zz15-sum-circle .sum-value {
    display: inline-block;
    transform: rotate(-90deg);
  }

  .zz15-sum-circle {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
    z-index: 12;
    pointer-events: none;
    margin-left: -10px;
    margin-top: -10px;
  }

  .zz15-cell:nth-child(odd) {
    padding-top: 13px !important;
  }

  .zz15-cell:nth-child(even) {
    padding-bottom: 13px !important;
  }
}

@media (orientation: portrait) and (max-width: 767px) {
  .col-md-auto {
    width: auto !important;
    margin: 0 auto;
  } 

  .board-stage.zz15-ready {
    width: 100%;
    max-width: min(390px, calc(100vw - 12px));
    min-height: 620px;
    height: 620px;
    margin-top: auto;
  }

  .board-stage.zz15-ready .zz15-canvas {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(90deg) scale(0.60);
    transform-origin: center center;
  }

  .zz15-help-column {
    --zz15-help-column-gap: calc(var(--zz15-help-digit-min-width) * 0.23);
    width: max(clamp(132px, 38vw, 168px), calc(var(--zz15-help-digit-min-width) * 6 + var(--zz15-help-column-gap) + 10px));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--zz15-help-column-gap);
    row-gap: 3px;
    transform: rotate(-90deg);
    transform-origin: center center;
  }

  .help-preview-canvas {
   min-height: 420px;
  }

  .help-preview-canvas .zz15-canvas {
    position: absolute;
    width: 1040px;
    height: 392px;
    pointer-events: none;
    margin-top: 0px;
    transform: rotate(90deg) scale(0.40) translate(-50%, -50%) !important;
  }

  .zz15-help-column.portrait-left .zz15-help-box:nth-child(1) { grid-column: 1; grid-row: 1; }
  .zz15-help-column.portrait-left .zz15-help-box:nth-child(2) { grid-column: 1; grid-row: 2; }
  .zz15-help-column.portrait-left .zz15-help-box:nth-child(3) { grid-column: 1; grid-row: 3; }
  .zz15-help-column.portrait-left .zz15-help-box:nth-child(4) { grid-column: 2; grid-row: 1; }
  .zz15-help-column.portrait-left .zz15-help-box:nth-child(5) { grid-column: 2; grid-row: 2; }

  .zz15-help-column.portrait-right .zz15-help-box:nth-child(1) { grid-column: 1; grid-row: 1; }
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(2) { grid-column: 1; grid-row: 2; }
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(3) { grid-column: 2; grid-row: 1; }
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(4) { grid-column: 2; grid-row: 2; }
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(5) { grid-column: 2; grid-row: 3; }

  .zz15-help-column.portrait-left .zz15-help-box:nth-child(4),
  .zz15-help-column.portrait-left .zz15-help-box:nth-child(5),
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(1),
  .zz15-help-column.portrait-right .zz15-help-box:nth-child(2) {
    transform: translateY(calc(50% + 1.5px));
  }

  .zz15-help-box .zz15-help-digit:nth-child(3n) {
    border-right: var(--zz15-help-separator-size) solid var(--soft-line);
  }

  .zz15-help-box .zz15-help-digit {
    border-right: var(--zz15-help-separator-size) solid var(--soft-line) !important;
  }

  .zz15-cell .cell-value,
  .zz15-sum-circle .sum-value {
    display: inline-block;
    transform: rotate(-90deg);
  }

    .zz15-sum-circle {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
    z-index: 12;
    pointer-events: none;
    margin-left: -10px;
    margin-top: -10px;
  }

  .zz15-cell:nth-child(odd) {
    padding-top: 13px !important;
  }

  .zz15-cell:nth-child(even) {
    padding-bottom: 13px !important;
  }
}

@media (orientation: landscape) and (max-width: 678px) {
  .zz15-numpad-layout-portrait {
    display: block;
  }
  .zz15-numpad-layout-landscape {
    display: none;
  }
}

@media (orientation: portrait) and (max-width: 429px) {
  .game-shell { 
    transform: scale(0.8); 
    margin-top: -25%;
  }

  .keypad-wrapper {
    max-width: 120%;
    width: 110%;
    margin: 0 auto !important;
    width: fit-content;
  }   
}

@media (orientation: portrait) and (max-width: 375px) {
  .keypad-wrapper {
    margin-left: -5% !important;
    width: fit-content;
  }   
}

@media (orientation: portrait) {
  .cell-note-grid {
    transform: rotate(90deg);
    transform-origin: center center;
  }

  .cell-note-grid .hint-cell {
    font-weight: 700;
    transform: rotate(-180deg);
  }

  .hint-cell.note-slot-1 { grid-column: 2; grid-row: 1; }
  .hint-cell.note-slot-2 { grid-column: 4; grid-row: 1; }
  .hint-cell.note-slot-3 { grid-column: 1; grid-row: 2; }
  .hint-cell.note-slot-4 { grid-column: 3; grid-row: 2; }
  .hint-cell.note-slot-5 { grid-column: 5; grid-row: 2; }
  .hint-cell.note-slot-6 { grid-column: 2; grid-row: 3; }
  .hint-cell.note-slot-7 { grid-column: 4; grid-row: 3; }
}

/* note portrait override shared */
@media (orientation: portrait) {
  .cell-note-grid {
    transform: rotate(90deg);
    transform-origin: 50% 50%;
  }

  .cell-note-grid .hint-cell {
    font-weight: 700;
    transform: rotate(-180deg);
  }

  .cell-note-grid .hint-cell.note-slot-1 { grid-column: 4; grid-row: 3; }
  .cell-note-grid .hint-cell.note-slot-2 { grid-column: 2; grid-row: 3; }
  .cell-note-grid .hint-cell.note-slot-3 { grid-column: 5; grid-row: 2; }
  .cell-note-grid .hint-cell.note-slot-4 { grid-column: 3; grid-row: 2; }
  .cell-note-grid .hint-cell.note-slot-5 { grid-column: 1; grid-row: 2; }
  .cell-note-grid .hint-cell.note-slot-6 { grid-column: 4; grid-row: 1; }
  .cell-note-grid .hint-cell.note-slot-7 { grid-column: 2; grid-row: 1; }
}


/* note base shared */
.cell-note-grid {
  position: absolute;
  inset: 14%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  z-index: 7;
  pointer-events: none;
}

.zz15-cell:nth-child(odd) .cell-note-grid {
  padding-left: 9px;
  margin-top: 7px;
  margin-bottom: -9px;
}

.zz15-cell:nth-child(even) .cell-note-grid {
  padding-left: 11px !important;
  margin-top: -9px;
  margin-bottom: 3px;
}

.hint-cell {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  color: #666;
  user-select: none;
  border: 0;
  background: transparent;
  border-radius: 4px;
  pointer-events: none;
  padding-right: 6px;
}

.hint-cell.note-slot-1 { grid-column: 2; grid-row: 1; }
.hint-cell.note-slot-2 { grid-column: 4; grid-row: 1; }
.hint-cell.note-slot-3 { grid-column: 1; grid-row: 2; }
.hint-cell.note-slot-4 { grid-column: 3; grid-row: 2; }
.hint-cell.note-slot-5 { grid-column: 5; grid-row: 2; }
.hint-cell.note-slot-6 { grid-column: 2; grid-row: 3; }
.hint-cell.note-slot-7 { grid-column: 4; grid-row: 3; }

#game.kubok-note-mode .hint-cell {
  color: #4a4a4a;
}
