/* coil.css — Coil sliding puzzle styles */

/* ── Splash ── */
#cl-splash {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cl-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 340px;
  width: 100%;
}

.cl-splash-logo {
  width: min(220px, 62vw);
  height: auto;
  filter: brightness(0) invert(1);
}

.cl-splash-dir {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  line-height: 1.68;
  color: rgba(241,245,249,0.55);
  text-align: left;
}

#cl-splash-play {
  width: 100%;
  padding: 14px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #FFD700;
  color: #0f172a;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 3px 0 #B8960A, 0 4px 8px rgba(0,0,0,0.5);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s, box-shadow 0.08s;
}
#cl-splash-play:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #B8960A, 0 2px 4px rgba(0,0,0,0.5);
}

/* ── Page layout ── */
body {
  background: #16161A;
}

#cl-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 16px 24px;
  gap: 14px;
}

/* ── Grid ── */
#cl-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 3px;
  background: #3A3A3C;
  border: 3px solid #3A3A3C;
  border-radius: 8px;
  width: min(calc(100vw - 32px), calc(100svh - 120px), 440px);
  aspect-ratio: 1;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#cl-grid.cl-no-transition .cl-tile svg {
  transition: none !important;
}

/* ── Tiles ── */
.cl-tile {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  background: #E4E2DC;
  box-shadow:
    inset 2px 2px 5px rgba(255,255,255,0.75),
    inset -2px -2px 5px rgba(0,0,0,0.22);
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

.cl-tile:active {
  cursor: grabbing;
}

.cl-tile.cl-locked {
  box-shadow:
    0 0 0 3px #FFD700,
    0 0 10px rgba(255,215,0,0.45),
    inset 2px 2px 5px rgba(255,255,255,0.65),
    inset -2px -2px 5px rgba(0,0,0,0.18);
  cursor: default;
}

.cl-tile.cl-blank {
  background: #2A2A2C;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
  cursor: default;
}

.cl-tile svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: transform 0.2s ease;
  transform-origin: center center;
}

/* ── Lock icon ── */
.cl-lock-icon {
  position: absolute;
  top: 7%;
  right: 7%;
  width: 22%;
  height: 22%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.cl-tile.cl-locked .cl-lock-icon {
  opacity: 1;
}

.cl-lock-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: none !important;
}

/* ── Hint ── */
#cl-hint {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.28);
  text-align: center;
  letter-spacing: 0.03em;
}

/* ── Directions overlay ── */
#cl-dir-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.cl-dir-modal {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 32px 28px 28px;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cl-dir-logo {
  width: min(150px, 48vw);
  height: auto;
  align-self: center;
  filter: brightness(0) invert(1);
}

.cl-dir-body {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  line-height: 1.7;
  color: rgba(241,245,249,0.65);
}

.cl-dir-body strong {
  color: rgba(241,245,249,0.9);
}

.cl-dir-close {
  width: 100%;
  padding: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  background: #FFD700;
  color: #0f172a;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ── Win overlay ── */
#cl-win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.cl-win-box {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 48px);
}

.cl-win-spiral {
  width: 80px;
  height: 80px;
  margin-bottom: 4px;
}

.cl-win-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: #FFD700;
  letter-spacing: -0.02em;
}

.cl-win-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: rgba(241,245,249,0.5);
  text-align: center;
  line-height: 1.5;
}

.cl-win-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 14px 40px;
  cursor: pointer;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.12s;
}
.cl-win-btn:active { opacity: 0.75; }

.cl-win-share {
  background: #FFD700;
  color: #0f172a;
}

.cl-win-again {
  background: rgba(255,255,255,0.08);
  color: #f1f5f9;
}

/* ── Win pulse animation ── */
@keyframes cl-gold-pulse {
  0%   { box-shadow: inset 2px 2px 5px rgba(255,255,255,0.75), inset -2px -2px 5px rgba(0,0,0,0.22); }
  40%  { box-shadow: 0 0 0 4px #FFD700, 0 0 20px rgba(255,215,0,0.7), inset 2px 2px 5px rgba(255,255,255,0.75); }
  100% { box-shadow: inset 2px 2px 5px rgba(255,255,255,0.75), inset -2px -2px 5px rgba(0,0,0,0.22); }
}

.cl-tile.cl-pulsing {
  animation: cl-gold-pulse 0.5s ease-in-out forwards;
}

.cl-hidden { display: none !important; }
