:root {
  --t: #1a1a1b;
  --navy: #0a253a;
  --blue: #24A0DA;
  --x: #787c7e;
  --b: #d3d6da;
  --tile: #efefe6;
  --yellow: #c9b458;
  --green: #7a9a5c;
  --blueg: #7a96b8;
  --purple: #8e7399;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: #fff;
  color: var(--t);
  font-family: "Helvetica Neue", Arial, sans-serif;
}
.wrap {
  max-width: 500px;
  margin: 0 auto;
  padding: 8px 12px 40px;
}
.sub {
  text-align: center;
  color: var(--x);
  font-size: 13px;
  margin: 0 0 12px;
}
#toasts {
  min-height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.toast {
  background: var(--t);
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 14px;
}
#board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 8px 0 16px;
}
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  min-width: 44px;
  padding: 6px 4px;
  background: var(--tile);
  border: 0;
  border-radius: 6px;
  font: 700 13px/1.2 "Helvetica Neue", Arial, sans-serif;
  text-transform: uppercase;
  color: var(--t);
  cursor: pointer;
  overflow-wrap: anywhere;
  word-break: break-word;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.tile.on {
  background: var(--t);
  color: #fff;
}
.tile:disabled { cursor: default; }
.solved {
  grid-column: 1 / -1;
  min-height: 64px;
  border-radius: 6px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  text-align: center;
}
.solved.l0 { background: var(--yellow); color: var(--t); }
.solved.l1 { background: var(--green); }
.solved.l2 { background: var(--blueg); }
.solved.l3 { background: var(--purple); }
.solved .gn { font-weight: 800; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; }
.solved .gw { font-size: 13px; margin-top: 2px; }
.solved .pearl {
  display: inline-block;
  margin-top: 6px;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
}
.row-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--x);
  font-size: 13px;
}
.dots { display: flex; gap: 6px; }
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--t);
}
.dot.off { background: var(--b); }
.btns {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.btns button {
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--t);
  background: #fff;
  color: var(--t);
  font: 700 14px "Helvetica Neue", Arial, sans-serif;
  cursor: pointer;
}
.btns button.primary {
  background: var(--t);
  color: #fff;
}
.btns button:disabled {
  opacity: 0.35;
  cursor: default;
}
#ov {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}
#ov.show { display: flex; }
#modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 23px rgba(0,0,0,.2);
  width: min(500px, 94vw);
  max-height: 92vh;
  overflow: auto;
  padding: 20px 16px;
  position: relative;
}
#close {
  position: absolute;
  right: 8px;
  top: 6px;
  border: 0;
  background: none;
  font-size: 22px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}
#mc h2 {
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  margin: 8px 0;
}
.stats { display: flex; justify-content: center; }
.stats div { flex: 1; text-align: center; max-width: 80px; }
.stats b { display: block; font-size: 32px; font-weight: 400; }
.stats span { font-size: 11px; color: var(--x); }
.share-row { display: flex; justify-content: center; margin: 16px 0; }
#share {
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 24px;
  font-weight: 700;
  font-size: 16px;
  padding: 12px 28px;
  cursor: pointer;
  min-height: 44px;
}
.guess-rows { text-align: center; font-size: 22px; letter-spacing: 2px; margin: 8px 0 12px; }
.next a {
  display: block;
  text-align: center;
  padding: 11px 12px;
  border: 1px solid var(--b);
  border-radius: 4px;
  margin: 6px 0;
  color: var(--t);
  text-decoration: none;
  font-weight: 700;
}
.tag { font-size: 11px; color: var(--x); text-align: center; margin-top: 12px; }
.tag a { color: var(--x); }
#board.shake { animation: shake 0.5s; }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
@media (max-width: 420px) {
  .tile { min-height: 52px; font-size: 11px; padding: 4px 2px; }
  .solved { min-height: 52px; }
}
