* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: #0d0d0f;
  color: #e8e6df;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 40px;
}

/* ── Dev bar ── */
#dev-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 16px;
  background: #1a0a2e;
  border-bottom: 2px solid #52389a;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
}

.dev-label {
  background: #52389a;
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

.dev-info {
  color: #8060d0;
  min-width: 180px;
  text-align: center;
}

.dev-btn {
  background: #2a1a4a;
  border: 1px solid #52389a;
  color: #c0a0f0;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  transition: background 0.15s;
}

.dev-btn:hover:not(:disabled) {
  background: #3a2060;
}

.dev-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

body:has(#dev-bar) {
  padding-top: 52px;
}

/* ── No-puzzle message ── */
.no-puzzle-msg {
  color: #666;
  font-size: 16px;
  padding: 40px;
  text-align: center;
}

/* ── Header ── */
.header {
  text-align: center;
  margin-bottom: 20px;
}

.logo {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 6px;
}

.title {
  font-family: 'Space Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: #f0ede6;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 13px;
  color: #888;
  margin-top: 6px;
  font-weight: 300;
}

/* ── Rule strip ── */
.rule-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #18181c;
  border: 1px solid #2a2a30;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 12px;
  color: #888;
  font-family: 'Space Mono', monospace;
}

.rule-label {
  color: #555;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-right: 4px;
}

.rule-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.rule-arrow {
  color: #444;
  font-size: 14px;
}

/* ── Info bar ── */
.info-bar {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  font-size: 12px;
  color: #666;
  font-family: 'Space Mono', monospace;
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.info-val {
  font-size: 20px;
  color: #ccc;
  font-weight: 700;
}

/* ── Grid ── */
.grid {
  display: grid;
  gap: 4px;
  margin-bottom: 20px;
}

/* ── Tiles ── */
.tile {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s, box-shadow 0.15s;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 2px 6px rgba(0,0,0,0.5);
}

.tile:hover {
  transform: scale(1.06);
}

.tile.on-path {
  border-color: rgba(255, 255, 255, 0.5);
}

.tile.head {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.2), 0 0 16px rgba(255,255,255,0.15);
  transform: scale(1.08);
}

.tile.hinted {
  box-shadow: 0 0 0 3px #fff, 0 0 20px rgba(255,255,255,0.4) !important;
  transform: scale(1.1) !important;
}

.tile.wrong {
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-5px); }
  75%       { transform: translateX(5px); }
}

/* ── Message ── */
.msg {
  font-size: 13px;
  color: #888;
  text-align: center;
  min-height: 20px;
  margin-bottom: 16px;
  transition: color 0.2s;
}

.msg.success { color: #7fc98a; font-weight: 500; }
.msg.error   { color: #e07070; }

/* ── Buttons ── */
.btn-row {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid #2a2a30;
  background: #18181c;
  color: #bbb;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-transform: uppercase;
}

.btn:hover {
  background: #222228;
  border-color: #3a3a44;
  color: #e0ddd6;
}

.btn-primary {
  background: #e8e6df;
  color: #0d0d0f;
  border-color: #e8e6df;
}

.btn-primary:hover {
  background: #fff;
  border-color: #fff;
  color: #000;
}

/* ── Modal overlay ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.show { display: flex; }

/* ── Win banner ── */
.win-banner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: #18181c;
  border: 1px solid #2a2a30;
  border-radius: 20px;
  padding: 36px 40px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
}

.win-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.win-label {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 4px;
  color: #555;
  text-transform: uppercase;
}

.win-title {
  font-family: 'Space Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  color: #f0ede6;
  letter-spacing: -0.01em;
}

.win-puzzle-num {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: #555;
  letter-spacing: 1px;
}

/* ── Win stats ── */
.win-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
}

.win-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.win-stat-val {
  font-family: 'Space Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: #f0ede6;
  line-height: 1;
}

.win-stat-label {
  font-size: 11px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Win grid ── */
.win-grid {
  display: grid;
  gap: 3px;
}

.win-cell {
  border-radius: 3px;
}

.win-cell.on-path {
  opacity: 1;
}

.win-cell.off-path {
  background: #1e1e22 !important;
  opacity: 1;
}

/* ── Close button ── */
.win-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: #555;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}

.win-close:hover {
  color: #ccc;
  background: #2a2a30;
}

/* ── Tomorrow message (in modal) ── */
.win-tomorrow {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

.win-tomorrow strong {
  color: #999;
}

/* ── Win footer (shown on page after modal closed) ── */
.win-footer {
  display: none;
  font-size: 13px;
  color: #666;
  text-align: center;
  padding: 14px 20px;
  border: 1px solid #222;
  border-radius: 10px;
  line-height: 1.6;
  max-width: 460px;
  width: 100%;
}

.win-footer.show { display: block; }

.win-footer strong { color: #999; }

/* ── Copy button ── */
.win-copy-btn {
  width: 100%;
  padding: 12px;
  font-size: 13px;
}

/* ── Share string (hidden, clipboard only) ── */
.share-str {
  display: none;
}
