/* Shared play UI — touch-first, JAND brand */
.play-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, var(--jand-purple-light) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, var(--jand-orange-light) 0%, transparent 50%),
    var(--bg);
}

.play-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(8px);
}

.play-top a {
  font-weight: 700;
  text-decoration: none;
  color: var(--sub);
  font-size: 0.9rem;
}

.play-top .title {
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  flex: 1;
}

.play-main {
  flex: 1;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.play-status {
  text-align: center;
  font-weight: 700;
  font-size: clamp(1.1rem, 3.5vw, 1.35rem);
  margin: 0 0 8px;
  color: var(--ink);
  min-height: 1.4em;
}

.play-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}

.play-chip {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--sub);
}

.play-chip.accent {
  background: var(--jand-purple);
  border-color: var(--jand-purple);
  color: #fff;
}

.play-board {
  background: #fff;
  border: 3px solid var(--jand-purple-light);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
  min-height: 200px;
}

.play-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.play-btn {
  appearance: none;
  border: none;
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 22px;
  border-radius: 16px;
  cursor: pointer;
  min-height: 48px;
  min-width: 120px;
  touch-action: manipulation;
  transition: transform 0.12s ease, filter 0.12s ease;
  box-shadow: 0 4px 0 rgba(26, 18, 36, 0.12);
}

.play-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(26, 18, 36, 0.12);
}

.play-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.play-btn-primary {
  background: var(--jand-purple);
  color: #fff;
}

.play-btn-secondary {
  background: var(--jand-orange);
  color: #fff;
}

.play-btn-ghost {
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--jand-purple-light);
  box-shadow: none;
}

.tile-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
}

.choices-wrap {
  margin-top: 16px;
  background: #fff;
  border: 3px solid var(--jand-orange-light);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
  width: 100%;
}

.mem-tile {
  aspect-ratio: 1;
  border-radius: 18px;
  border: 3px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, border-color 0.1s ease, background 0.1s ease;
  padding: 8px;
}

@media (max-width: 480px) {
  .tile-grid {
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }

  .choices-wrap {
    padding: 12px;
    border-radius: 18px;
  }

  .mem-tile {
    border-radius: 14px;
    border-width: 2px;
    padding: 6px;
  }

  .mem-tile .emoji {
    font-size: clamp(1.5rem, 7vw, 2.2rem);
  }

  .mem-tile .label {
    font-size: 0.68rem;
    line-height: 1.15;
    text-align: center;
  }
}

.mem-tile .emoji {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  line-height: 1;
}

.mem-tile .label {
  font-size: 0.75rem;
  color: var(--sub);
}

.mem-tile:active {
  transform: scale(0.96);
}

.mem-tile.selected {
  border-color: var(--jand-purple);
  background: var(--jand-purple-light);
}

.mem-tile.correct {
  border-color: #2F9E5F;
  background: #E3F6EB;
}

.mem-tile.wrong {
  border-color: var(--jand-orange);
  background: var(--jand-orange-light);
}

.mem-tile.covered {
  background: linear-gradient(145deg, var(--jand-purple), #7a54a8);
  border-color: transparent;
  color: transparent;
}

.mem-tile.covered .emoji,
.mem-tile.covered .label {
  visibility: hidden;
}

.mem-tile.found {
  outline: 3px solid var(--jand-orange);
  background: var(--jand-orange-light);
}

.seq-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  min-height: 92px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 16px;
  background: var(--bg);
  border: 2px dashed var(--line);
}

.seq-slot {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 3px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.seq-slot.dot-only {
  font-size: 0;
}

.seq-slot .dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.palette {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 10px;
}

.diff-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) {
  .diff-pair {
    grid-template-columns: 1fr 1fr;
  }
}

.diff-panel {
  border: 3px solid var(--jand-purple-light);
  border-radius: 18px;
  padding: 12px;
  background: #fff;
}

.diff-panel h3 {
  margin: 0 0 10px;
  text-align: center;
  font-size: 1rem;
  color: var(--jand-purple);
}

.diff-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.diff-tile {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.diff-tile.same {
  cursor: default;
}

.diff-tile.wrong {
  animation: shake 0.28s ease;
  border-color: var(--jand-orange);
  background: var(--jand-orange-light);
}

.diff-tile.hit {
  border-color: #2F9E5F;
  background: #E3F6EB;
  box-shadow: 0 0 0 3px rgba(47, 158, 95, 0.35);
}

.celebrate {
  text-align: center;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--jand-orange-light);
  border: 2px dashed var(--jand-orange);
  font-weight: 700;
  color: var(--ink);
}

.celebrate.is-correct {
  background: #E3F6EB;
  border: 2px solid #2F9E5F;
  color: #1B6B3A;
}

.celebrate.is-wrong {
  background: var(--jand-orange-light);
  border: 2px dashed var(--jand-orange);
  color: var(--ink);
}

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

.start-card {
  text-align: center;
  padding: 12px 4px 8px;
}

.start-card .big {
  font-size: 3.2rem;
  margin-bottom: 8px;
}

.start-card p {
  color: var(--sub);
  font-weight: 600;
  margin: 0 0 18px;
}

.mode-picks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 auto 8px;
  max-width: 360px;
}

.mode-pick {
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  border: 3px solid var(--line);
  background: #fff;
  font-family: var(--font);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.mode-pick strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 2px;
}

.mode-pick span {
  font-weight: 600;
  color: var(--sub);
  font-size: 0.9rem;
}

.mode-pick.active {
  border-color: var(--jand-purple);
  background: #f3ebfb;
}

/* Level-up celebration */
.play-chip.level-chip-pop,
#chip-level.level-chip-pop {
  animation: level-chip-bounce 0.65s ease;
}

@keyframes level-chip-bounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.18); }
  60% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

.level-up-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
  background: radial-gradient(circle at center, rgba(255, 248, 240, 0.55), transparent 65%);
}

.level-up-overlay.is-on {
  opacity: 1;
}

.level-up-card {
  position: relative;
  min-width: min(280px, 86vw);
  max-width: 340px;
  text-align: center;
  background: #fff;
  border: 3px solid var(--jand-orange);
  border-radius: 22px;
  padding: 22px 20px 18px;
  box-shadow: 0 10px 0 rgba(255, 155, 79, 0.22);
  animation: level-up-pop 0.45s cubic-bezier(0.2, 1.2, 0.3, 1);
}

@keyframes level-up-pop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.level-up-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: clamp(1.35rem, 4.5vw, 1.7rem);
  color: var(--ink);
  margin-bottom: 6px;
}

.level-up-badge {
  display: inline-block;
  margin: 4px 0 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--jand-purple);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.level-up-detail {
  font-weight: 600;
  color: var(--sub);
  font-size: 0.95rem;
  line-height: 1.35;
}

.level-up-burst {
  position: absolute;
  left: 50%;
  top: 18px;
  width: 0;
  height: 0;
  pointer-events: none;
}

.level-up-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  left: 0;
  top: 0;
  opacity: 0;
  animation: level-up-spark 0.9s ease-out forwards;
}

@keyframes level-up-spark {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg) scale(0.4);
  }
  20% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1);
  }
}
