/* Suguru — Playnesta original (MIT). Grid, cages, buttons. */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  background: radial-gradient(circle at 50% 18%, #2b3444, #161f2b 70%);
  color: #eef2f8;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: calc(var(--pn-vh, 1vh) * 100);
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  gap: 8px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand small {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.65;
  margin-left: 6px;
  text-transform: lowercase;
}
.meta {
  display: flex;
  gap: 10px;
}
.meta span {
  font-size: 14px;
  opacity: 0.9;
}
.modes {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.boardwrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.boardbox {
  display: grid;
  gap: 2px;
  touch-action: manipulation;
}
.cell {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #eef2f8;
}
.cell.given {
  font-weight: 800;
  color: #ffffff;
}
.cell.given::after {
  content: "";
  position: absolute;
  inset: auto auto 4px 50%;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.75);
  transform: translateX(-50%);
}
.cell.sel {
  outline: 2px solid #7fd4ff;
  outline-offset: -2px;
  z-index: 2;
}
.cell.bad {
  color: #fff;
  background: #a03a3a !important;
  border-color: #e06565;
}
.msg {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  min-height: 24px;
}
.palette {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.palette .num {
  min-width: 52px;
}
.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid #6f92c4;
  background: #2b3b52;
  color: #eef2f8;
  cursor: pointer;
}
.btn.primary {
  background: #6f92c4;
  color: #fff;
  border-color: #9dc0e8;
}
.btn.mode.on {
  background: #6f92c4;
  color: #fff;
  border-color: #9dc0e8;
}
.btn:active {
  transform: scale(0.97);
}
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 20, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.overlay.hidden {
  display: none;
}
.panel {
  background: #1d2837;
  border: 1px solid #6f92c4;
  border-radius: 16px;
  padding: 18px;
  max-width: 420px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 20px;
}
.panel p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.5;
}
.panel-wide {
  max-width: 520px;
}
.rules-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.55;
}
.rules-list li {
  margin-bottom: 8px;
}
@media (max-width: 430px) {
  .cell {
    width: 32px;
    height: 32px;
    font-size: 17px;
  }
  .palette .num {
    min-width: 44px;
  }
}
