:root {
  --pixlogic-spiral-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 12.5c0-.8.6-1.3 1.3-1.1.6.2 1 .8.7 1.5-.3.7-1.1.9-1.8.6-1-.5-1.4-1.6-.7-2.6.9-1.3 2.8-1.6 4-.7 1.5 1.1 1.8 3.2.7 4.7-1.3 1.8-3.8 2.2-5.7 1.1-2.3-1.4-2.7-4.6-1-6.9 2-2.8 6-3.4 8.7-1.4 3.2 2.4 3.7 7 1.1 9.8-3.1 3.4-8.6 3.8-11.8.9-3.7-3.2-4.1-9-.8-12.6' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.puzzle-list-card {
  justify-content: center;
  min-height: 6rem;
  padding: 1.5rem;
}

.puzzle-group-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 6rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.puzzle-group-card:hover {
  border-color: rgba(233, 69, 96, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.puzzle-color-badge {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  color: #d0d0e0;
  pointer-events: none;
}

.puzzle-color-badge-icon {
  width: 100%;
  height: 100%;
  display: block;
}

.puzzle-group-card h2 {
  font-size: 1.25rem;
  text-align: center;
}

.puzzle-difficulty-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.puzzle-difficulty-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.puzzle-difficulty-link {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  color: #e8e8e8;
  text-align: center;
  transition: background 0.2s, border-color 0.2s;
}

.puzzle-difficulty-link:hover {
  background: rgba(233, 69, 96, 0.18);
  border-color: rgba(233, 69, 96, 0.45);
}

.puzzle-solved-badge {
  color: #4ade80;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
}

.puzzle-solved-badge[hidden] {
  display: none;
}

.puzzle-difficulty-size {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: #a0a0b0;
}

.game-difficulty {
  font-weight: 600;
  color: #f5a623;
}

.puzzle-list-card h2 {
  padding: 0;
}

.puzzle-list-card p {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #a0a0b0;
}

.game-header {
  margin-bottom: 0.75rem;
}

.game-rules {
  margin-bottom: 0.75rem;
  padding: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #c0c0d0;
}

.game-rules details {
  padding: 0.75rem 1rem;
}

.game-rules summary {
  cursor: pointer;
  font-weight: 600;
  color: #e8e8e8;
  list-style-position: outside;
}

.game-rules summary::-webkit-details-marker {
  color: #a0a0b0;
}

.game-rules details[open] summary {
  margin-bottom: 0.75rem;
}

.game-rules-intro {
  margin-bottom: 0.75rem;
}

.game-rules-list {
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.game-rules-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.rule-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.rule-number {
  color: #fff;
}

.rule-uniform {
  position: relative;
  background: #fff;
  border-radius: 0.25rem;
}

.rule-uniform::before {
  content: '';
  width: 1.4375rem;
  height: 1.4375rem;
  background: var(--pixlogic-spiral-icon) center / contain no-repeat;
}

.rule-black-arrow,
.rule-white-arrow {
  position: relative;
}

.rule-black-arrow::before,
.rule-white-arrow::before,
.rule-black-arrow::after,
.rule-white-arrow::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
}

.rule-black-arrow::before {
  top: 0.05rem;
  border-left: 0.5rem solid transparent;
  border-right: 0.5rem solid transparent;
  border-bottom: 0.78rem solid #333;
}

.rule-black-arrow::after {
  top: 0.12rem;
  border-left: 0.4rem solid transparent;
  border-right: 0.4rem solid transparent;
  border-bottom: 0.62rem solid #000;
}

.rule-white-arrow::before {
  bottom: 0.03rem;
  border-left: 0.58rem solid transparent;
  border-right: 0.58rem solid transparent;
  border-top: 0.88rem solid #222;
}

.rule-white-arrow::after {
  bottom: 0.14rem;
  border-left: 0.38rem solid transparent;
  border-right: 0.38rem solid transparent;
  border-top: 0.58rem solid #fff;
}

.game-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.game-toolbar-actions,
.game-toolbar-hints {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.game-toolbar-hints .game-message {
  flex: 1 1 12rem;
  min-width: 0;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

.game-toolbar-actions .btn-icon {
  touch-action: manipulation;
}

.btn-icon svg {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
}

.btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-icon:disabled:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

body:has(.game-play-area) .container.wide {
  max-width: none;
  width: max-content;
  min-width: 100%;
}

.game-play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: max-content;
  min-width: 100%;
  margin-inline: auto;
}

.board-wrapper {
  position: relative;
  overflow: visible;
  width: max-content;
  max-width: none;
  padding: 0;
  background: transparent;
  border: none;
}

.progress-preview.solution-reveal {
  box-shadow: 0 0 0 2px #e94560;
}

.progress-preview {
  display: grid;
  gap: 0;
  background: #c8c8c8;
  padding: 2px;
  border-radius: 0.5rem;
  box-shadow: 0 0 0 1px #ddd;
  flex-shrink: 0;
}

.progress-cell {
  width: var(--preview-cell, 4px);
  height: var(--preview-cell, 4px);
  background: transparent;
}

.progress-cell.white {
  background: #fff;
  box-shadow: inset 0 0 0 1px #bbb;
}

.progress-cell.black {
  background: #1a1a2e;
}

.progress-cell.colored {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.btn {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  color: #e8e8e8;
  font: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(233, 69, 96, 0.4);
}

.btn-primary {
  background: rgba(233, 69, 96, 0.25);
  border-color: rgba(233, 69, 96, 0.5);
}

.btn-primary:hover {
  background: rgba(233, 69, 96, 0.4);
}

.game-message {
  color: #a0a0b0;
  font-size: 0.95rem;
  min-height: 1.45em;
}

.game-message.success {
  color: #4ade80;
  font-weight: 600;
}

.game-message.error {
  color: #f87171;
}

.cell.hint-target {
  position: relative;
  z-index: 1;
}

.hint-marker {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid #e94560;
  background: transparent;
  box-sizing: border-box;
  pointer-events: none;
  animation: hint-marker-blink 0.6s ease-in-out infinite;
}

@keyframes hint-marker-blink {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: 0.2;
  }
}

.game-message.hint {
  color: #f5a623;
}

#btn-hint:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#btn-hint:disabled:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

#btn-hint {
  min-width: 6.5rem;
}

#btn-replay-hint.is-layout-hidden {
  visibility: hidden;
  pointer-events: none;
}

.board {
  --grid-unit: 22px;
  --dot-size: calc(var(--grid-unit) * 2);
  display: grid;
  gap: 0;
  width: fit-content;
  margin: 0 auto;
  user-select: none;
  touch-action: manipulation;
  background: #fff;
  padding: calc((var(--dot-size) - var(--grid-unit)) / 2 + 2px);
  border-radius: 0.5rem;
  box-shadow: 0 0 0 1px #ddd;
}

.board-large .cell {
  transition: none;
}

.board-large .cell:hover {
  transition: none;
}

.cell {
  width: var(--dot-size);
  height: var(--dot-size);
  justify-self: center;
  align-self: center;
  box-sizing: border-box;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #b0b0b0;
  box-shadow: inset 0 0 0 2px #888;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.cell:hover {
  box-shadow: inset 0 0 0 2px #e94560;
}

.cell.white {
  background: #fff;
  box-shadow: inset 0 0 0 2px #888;
}

.cell.black {
  background: #1a1a2e;
  box-shadow: inset 0 0 0 2px #000;
}

.cell.unknown {
  background: #b0b0b0;
  box-shadow: inset 0 0 0 2px #888;
}

.vertex {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--grid-unit);
  height: var(--grid-unit);
  font-size: calc(var(--grid-unit) * 0.7);
  font-weight: 700;
  line-height: 1;
  color: #f5a623;
  font-family: 'Segoe UI Historic', system-ui, sans-serif;
  pointer-events: none;
}

.vertex.clue-number {
  color: #333;
  font-weight: 600;
}

.vertex.clue-uniform::before {
  content: '';
  width: calc(var(--grid-unit) * 0.975);
  height: calc(var(--grid-unit) * 0.975);
  background: var(--pixlogic-spiral-icon) center / contain no-repeat;
}

.vertex.clue-majorityBlack,
.vertex.clue-majorityWhite {
  position: relative;
}

.vertex.clue-majorityBlack::before,
.vertex.clue-majorityWhite::before,
.vertex.clue-majorityBlack::after,
.vertex.clue-majorityWhite::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
}

.vertex.clue-majorityBlack::before {
  top: 8%;
  border-left: calc(var(--grid-unit) * 0.35) solid transparent;
  border-right: calc(var(--grid-unit) * 0.35) solid transparent;
  border-bottom: calc(var(--grid-unit) * 0.55) solid #333;
}

.vertex.clue-majorityBlack::after {
  top: 14%;
  border-left: calc(var(--grid-unit) * 0.28) solid transparent;
  border-right: calc(var(--grid-unit) * 0.28) solid transparent;
  border-bottom: calc(var(--grid-unit) * 0.44) solid #000;
}

.vertex.clue-majorityWhite::before {
  bottom: 7%;
  border-left: calc(var(--grid-unit) * 0.42) solid transparent;
  border-right: calc(var(--grid-unit) * 0.42) solid transparent;
  border-top: calc(var(--grid-unit) * 0.62) solid #222;
}

.vertex.clue-majorityWhite::after {
  bottom: 13%;
  border-left: calc(var(--grid-unit) * 0.26) solid transparent;
  border-right: calc(var(--grid-unit) * 0.26) solid transparent;
  border-top: calc(var(--grid-unit) * 0.40) solid #fff;
}

.board-spacer {
  width: var(--grid-unit);
  height: var(--grid-unit);
}

@media (max-width: 600px) {
  body:has(.game-play-area) .container.wide {
    max-width: none;
    width: max-content;
    min-width: 100%;
  }

  .container.wide {
    padding: 1rem 0.5rem;
  }

  .game-header h1 {
    font-size: 1.5rem;
  }
}
