.zip-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
  border: 1px solid rgba(19, 27, 45, 0.14);
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
}
.zip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}
.zip-header h1 {
  margin: 0;
  font-size: 1.45rem;
}
.zip-new-game {
  border: 1px solid rgba(31, 51, 89, 0.35);
  border-radius: 10px;
  padding: 0.45rem 0.95rem;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: #152a52;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.zip-new-game:hover {
  background: transparent;
  border-color: rgba(31, 51, 89, 0.55);
  box-shadow: 0 4px 14px rgba(31, 51, 89, 0.18);
  transform: translateY(-1px);
}
.zip-new-game:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(31, 51, 89, 0.12);
}
.zip-new-game:focus-visible {
  outline: 2px solid #3b5bdb;
  outline-offset: 2px;
}
.zip-controls {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0;
}
.zip-controls button,
.zip-controls select {
  border-radius: 10px;
  border: 1px solid rgba(31, 51, 89, 0.28);
  min-height: 40px;
  background: transparent;
  font: inherit;
  padding: 0 0.6rem;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.zip-controls select {
  padding-right: 1.8rem;
}
.zip-controls button {
  cursor: pointer;
  font-weight: 700;
}
.zip-controls button:hover {
  background: transparent;
}
.zip-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 0.9rem;
}
.zip-board-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(27, 39, 65, 0.2);
  border-radius: 14px;
  min-height: 420px;
  background: transparent;
  padding: 0.65rem;
}
.zip-board-stack {
  position: relative;
  width: min(95vw, 560px, var(--zip-board-fit, 560px));
  aspect-ratio: 1 / 1;
}
.zip-board {
  display: grid;
  gap: 0;
  touch-action: none;
  user-select: none;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 3;
}
.zip-path-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}
.zip-wall-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.zip-wall {
  position: absolute;
  background: #0a0f18;
  border-radius: 1px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.zip-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(37, 53, 83, 0.14);
  background: transparent;
  font-weight: 700;
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  color: #0e1f3e;
  position: relative;
  transition: box-shadow 0.22s ease, filter 0.22s ease, border-color 0.22s ease;
}
.zip-cell.is-path {
  background: transparent;
  border-color: rgba(37, 53, 83, 0.12);
  color: #0e1f3e;
}
.zip-cell.is-head {
  outline: none;
}
.zip-cell .zip-checkpoint {
  pointer-events: none;
  width: var(--zip-checkpoint-size, 26px);
  height: var(--zip-checkpoint-size, 26px);
  border-radius: 999px;
  background: linear-gradient(155deg, #16082a 0%, #2a1858 45%, #1e1244 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  line-height: 1;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55), 0 4px 14px rgba(60, 30, 120, 0.4);
}
.zip-cell.is-path .zip-checkpoint {
  background: linear-gradient(160deg, #0f0620 0%, #201050 50%, #140830 100%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.65), 0 2px 10px rgba(0, 0, 0, 0.35), 0 0 16px rgba(180, 140, 255, 0.35);
}
.zip-timer-top {
  margin: 0;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(41, 66, 109, 0.2);
  background: transparent;
  color: #18305f;
  font-weight: 700;
  font-size: 0.95rem;
  width: 138px;
  min-width: 138px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  white-space: nowrap;
}
.zip-status {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(41, 66, 109, 0.18);
  min-height: 46px;
  font-size: 0.95rem;
}
.zip-solved-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(86%, 450px);
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(115, 76, 226, 0.36);
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 224, 143, 0.32) 0 24px, transparent 25px),
    radial-gradient(circle at 88% 18%, rgba(255, 170, 226, 0.24) 0 20px, transparent 21px),
    radial-gradient(circle at 84% 82%, rgba(132, 214, 255, 0.22) 0 22px, transparent 23px),
    rgba(255, 255, 255, 0.92);
  color: #22133f;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  display: none;
  pointer-events: none;
  z-index: 6;
  box-shadow: 0 12px 34px rgba(36, 24, 85, 0.18);
  backdrop-filter: blur(1.5px);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  overflow: hidden;
}
.zip-solved-overlay::before,
.zip-solved-overlay::after {
  content: "✦";
  position: absolute;
  color: rgba(116, 75, 232, 0.7);
  font-size: 1rem;
  animation: zip-sparkle-float 1.8s ease-in-out infinite;
}
.zip-solved-overlay::before {
  left: 0.85rem;
  top: 0.5rem;
}
.zip-solved-overlay::after {
  right: 0.85rem;
  bottom: 0.5rem;
  animation-delay: 0.45s;
}
.zip-solved-overlay.is-visible {
  display: block;
  animation: zip-sparkle-pop 0.55s ease-out;
}
@keyframes zip-sparkle-pop {
  0% { opacity: 0; transform: translate(-50%, -42%) scale(0.94); filter: saturate(0.7) brightness(0.95); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: saturate(1.08) brightness(1); }
}
@keyframes zip-sparkle-float {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.65; }
  50% { transform: translateY(-4px) rotate(10deg); opacity: 1; }
}
.zip-help {
  margin-top: 0.8rem;
  color: #19305e;
  font-size: 0.9rem;
}
[data-theme="dark"] .zip-shell { border-color: rgba(162, 178, 222, 0.26); }
[data-theme="dark"] .zip-header h1 { color: #e8ecff; }
[data-theme="dark"] .zip-new-game,
[data-theme="dark"] .zip-controls button,
[data-theme="dark"] .zip-controls select {
  color: #e6ebff;
  border-color: rgba(150, 168, 218, 0.4);
  background: rgba(18, 24, 43, 0.48);
}
[data-theme="dark"] .zip-new-game:hover,
[data-theme="dark"] .zip-controls button:hover {
  background: rgba(31, 45, 79, 0.62);
  border-color: rgba(172, 188, 233, 0.6);
}
[data-theme="dark"] .zip-timer-top {
  color: #dbe5ff;
  border-color: rgba(152, 173, 226, 0.42);
  background: rgba(20, 30, 58, 0.58);
}
[data-theme="dark"] .zip-board-wrap {
  border-color: rgba(152, 173, 226, 0.24);
  background: rgba(11, 18, 36, 0.35);
}
[data-theme="dark"] .zip-cell {
  border-color: rgba(142, 163, 218, 0.2);
  color: #dbe5ff;
}
[data-theme="dark"] .zip-cell.is-path { border-color: rgba(142, 163, 218, 0.22); }
[data-theme="dark"] .zip-wall {
  background: #f4f7ff;
  box-shadow: 0 0 0 1px rgba(16, 23, 43, 0.5);
}
[data-theme="dark"] .zip-status {
  color: #d8e4ff;
  border-color: rgba(152, 173, 226, 0.34);
  background: rgba(18, 27, 50, 0.42);
}
[data-theme="dark"] .zip-help { color: #c3d3ff; }
[data-theme="dark"] .zip-solved-overlay {
  border-color: rgba(185, 160, 255, 0.62);
  color: #f2f5ff;
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 224, 143, 0.24) 0 24px, transparent 25px),
    radial-gradient(circle at 88% 18%, rgba(255, 170, 226, 0.18) 0 20px, transparent 21px),
    radial-gradient(circle at 84% 82%, rgba(132, 214, 255, 0.18) 0 22px, transparent 23px),
    rgba(20, 24, 48, 0.9);
  box-shadow: 0 14px 36px rgba(4, 6, 18, 0.5);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
/* Mobile/tablet toolbar only — desktop (1025px+) unchanged */
@media (max-width: 1024px) {
  .zip-game-page .zip-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--ws-toolbar-control-height, 2.35rem);
    grid-template-rows: auto auto auto;
    gap: 0.55rem;
    align-items: stretch;
  }

  .zip-game-page .zip-controls {
    display: contents;
  }

  .zip-game-page #zip-mode-select {
    grid-column: 1;
    grid-row: 1;
  }

  .zip-game-page #zip-undo-btn {
    grid-column: 2;
    grid-row: 1;
  }

  .zip-game-page .zip-toolbar .word-search-game-shell__expand-btn {
    grid-column: 3;
    grid-row: 1;
    justify-self: stretch;
    align-self: stretch;
    width: 100%;
    min-height: 40px;
  }

  .zip-game-page #zip-clear-btn {
    grid-column: 1;
    grid-row: 2;
  }

  .zip-game-page #zip-hint-btn {
    grid-column: 2;
    grid-row: 2;
  }

  .zip-game-page .zip-timer-top {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .zip-board-wrap {
    min-height: 0;
    padding: 0.35rem;
  }
  .zip-board-stack {
    width: min(98vw, 560px, var(--zip-board-fit, 560px));
  }
  .zip-board {
    -webkit-tap-highlight-color: transparent;
  }
}
