body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  background: rgb(255, 255, 255);

  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#gridHolder {
  display: flex;
  justify-content: center;
  max-width: 100vw;
  margin: 0.4vw 1vw 0.4vw 1vw;
}

#gridSpinner {
  position: relative;
  display: inline-block;
}

#grid {
  cursor: pointer;
  display: block;
}

.board-splash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.18s ease;
  z-index: 3;
}

.board-splash.board-splash-hidden {
  opacity: 0;
}

.board-splash-card {
  max-width: 82%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dee2e6;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  padding: 14px 18px;
  color: #212529;
  text-align: left;
}

.board-splash-title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  color: #212529;
  margin-bottom: 2px;
}

.board-splash-subtitle {
  font-size: 12px;
  color: #6c757d;
  text-align: center;
  margin-bottom: 10px;
}

.board-splash-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: #343a40;
}

.board-splash-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.board-splash-list li:last-child {
  margin-bottom: 0;
}

.board-splash-list li i {
  width: 14px;
  text-align: center;
  color: #6c757d;
  flex-shrink: 0;
}

@keyframes boardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.shake-reject {
  animation: boardShake 0.32s ease-in-out;
}

#trayHolder {
  display: flex;
  justify-content: center;
  max-width: 100vw;
  margin: 0 1vw 0.5em 1vw;
}

#trayContainer {
  position: relative;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 10px 10px 10px 24px;
}

.tray-help-icon {
  position: absolute;
  top: 5px;
  left: 6px;
  color: #6c757d;
  font-size: 13px;
  line-height: 1;
  cursor: help;
  z-index: 5;
  outline: none;
}

.tray-help-icon:hover,
.tray-help-icon:focus {
  color: #212529;
}

.tray-help-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 250px;
  background: rgba(33, 37, 41, 0.95);
  color: #ffffff;
  font-size: 12px;
  font-weight: normal;
  line-height: 1.35;
  padding: 7px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 20;
}

.tray-help-icon:hover .tray-help-tooltip,
.tray-help-icon:focus .tray-help-tooltip {
  visibility: visible;
  opacity: 1;
}

#statusHolder {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100vw;
}

#statusBanner {
  margin-bottom: 0.35em;
  text-align: center;
}

#solutionActionsHolder {
  text-align: center;
  margin-bottom: 0.5em;
}

.hint-requirement {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12.5px;
  color: #6c757d;
}

.hint-pips {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hint-pip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #198754;
  background-color: transparent;
  transition: background-color 0.15s ease;
}

.hint-pip.filled {
  background-color: #198754;
}

#pieceTray {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  min-height: 70px;
}

#pieceTray.measuring-flip .piece-card,
#pieceTray.measuring-flip .piece-preview {
  transition: none !important;
}

.piece-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 44px;
  background: #ffffff;
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: grab;
  touch-action: none;
  will-change: transform;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.piece-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  border-color: #495057;
}

.piece-card:active {
  cursor: grabbing;
}

.piece-card.piece-dragging {
  opacity: 0.35;
  cursor: grabbing;
}

.piece-card.piece-unfit-current {
  border-color: #e0a800;
  background: #fffdf8;
}

.piece-card.piece-unfit-current:hover {
  border-color: #dc3545;
}

.piece-card.piece-unfit {
  opacity: 0.65;
  border-style: dashed;
  border-color: #dc3545;
  background: #fff8f8;
}

.piece-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #222222;
  font-size: 11px;
  font-weight: bold;
  color: #1a1a1a;
  box-sizing: border-box;
  overflow: hidden;
  transition: width 0.2s cubic-bezier(0.22, 1, 0.36, 1), height 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.piece-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #111111;
  font-weight: bold;
  color: #1a1a1a;
  box-sizing: border-box;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  opacity: 0.85;
  transform: translate(-50%, -50%);
}

.piece-preview-label {
  display: inline-block;
  white-space: nowrap;
  line-height: 1;
  pointer-events: none;
}

.piece-preview-label.label-vertical {
  transform: rotate(-90deg);
}

.piece-preview-label.label-compact {
  font-size: 8.5px;
}

.piece-preview.preview-overflow-right {
  border-right: 2.5px dashed #dc3545;
}

.piece-preview.preview-overflow-bottom {
  border-bottom: 2.5px dashed #dc3545;
}

.piece-fit-hint {
  font-size: 10px;
  margin-top: 3px;
  line-height: 1.1;
  font-weight: 600;
}

.piece-fit-hint.hint-rotate {
  color: #b45309;
}

.piece-fit-hint.hint-nofit {
  color: #dc3545;
}

.piece-rotate-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.piece-rotate-btn:hover {
  background: #e9ecef;
  color: #000;
}

.piece-rotate-btn.rotate-highlight {
  background: #ffc107;
  color: #111;
}

#faqHolder {
  display: flex;
  justify-content: center;
  max-width: 100vw;
}
