/* Guess-from-clues tool */
.cr-big { font-size: 20px; }
.cr-how { padding-left: 20px; line-height: 1.7; }
.cr-check { display: flex; gap: 8px; align-items: center; justify-content: center; font-family: var(--sg-font-th); cursor: pointer; }
.cr-check input { width: 18px; height: 18px; accent-color: var(--sg-blue); }

/* setup */
.cr-round label { display: block; }
.cr-roundhead { display: flex; align-items: center; justify-content: space-between; }
.cr-roundhead b { font-size: 18px; }
.cr-x {
  border: 2px solid var(--sg-ink);
  background: #fff;
  border-radius: 10px;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  cursor: pointer;
  font-family: var(--sg-font-th);
  color: var(--sg-ink);
  flex: 0 0 auto;
}
.cr-round.armed [data-del] { background: var(--sg-red); color: #fff; }
.cr-clues { display: grid; gap: 8px; }
.cr-cluerow { display: flex; gap: 8px; align-items: center; }
.cr-cluerow input { flex: 1; min-width: 0; }
.cr-num {
  flex: 0 0 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sg-yellow);
  border: 2px solid var(--sg-ink);
  font-family: var(--sg-font-card);
  font-weight: 600;
}

/* play */
.cr-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cr-roundno { font-family: var(--sg-font-card); font-weight: 600; font-size: 18px; }
.cr-question { text-align: center; }
.cr-q { font-size: clamp(26px, 5vw, 44px); font-weight: 600; line-height: 1.3; }
.cr-opened { color: var(--sk-muted); margin-top: 4px; }
.cr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.cr-cards.few { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.cr-card {
  position: relative;
  min-height: 130px;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
  font-family: var(--sg-font-th);
  animation: crIn 0.35s ease-out backwards;
}
.cr-inner {
  position: absolute;
  inset: 0;
  transition: transform 0.55s cubic-bezier(0.3, 1.3, 0.5, 1);
  transform-style: preserve-3d;
}
.cr-card.open .cr-inner { transform: rotateY(180deg); }
.cr-card.open { cursor: default; }
.cr-front, .cr-back {
  position: absolute;
  inset: 0;
  border: 3px solid var(--sg-ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--sg-ink);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
}
.cr-front {
  background: var(--sg-blue);
  color: #fff;
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 12px, transparent 12px 24px);
}
.cr-front b { font-family: var(--sg-font-card); font-size: 54px; line-height: 1; -webkit-text-stroke: 2px var(--sg-ink); paint-order: stroke fill; }
.cr-front small { opacity: 0.85; margin-top: 6px; }
.cr-card:not(.open):hover .cr-inner { transform: translateY(-3px); }
.cr-back { background: #fff; color: var(--sg-ink); transform: rotateY(180deg); }
.cr-back i {
  position: absolute;
  top: 8px;
  left: 10px;
  font-style: normal;
  font-family: var(--sg-font-card);
  font-weight: 600;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sg-yellow);
  border: 2px solid var(--sg-ink);
  font-size: 14px;
}
.cr-text { font-size: clamp(18px, 2.2vw, 24px); font-weight: 500; line-height: 1.35; text-align: center; overflow-wrap: anywhere; }
.cr-answer { text-align: center; display: grid; gap: 4px; }
.cr-answer small { color: var(--sk-muted); }
.cr-answer b { font-size: clamp(32px, 7vw, 60px); line-height: 1.2; overflow-wrap: anywhere; }
.cr-answer.shown { background: var(--sk-cream); }
.cr-answer.shown b { animation: crPop 0.6s cubic-bezier(0.3, 1.6, 0.5, 1); color: var(--sk-green-dark); }
.cr-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cr-controls .sg-btn { font-size: 17px; }
.cr-end { text-align: center; }
.cr-endtitle { font-size: clamp(30px, 7vw, 42px); font-weight: 600; }

@media (max-width: 560px) {
  .cr-controls { grid-template-columns: 1fr 1fr; }
  .cr-controls #nextBtn { grid-column: 1 / -1; }
  .cr-card { min-height: 110px; }
  .cr-front b { font-size: 44px; }
}
@keyframes crIn { from { transform: translateY(12px) scale(0.92); opacity: 0; } }
@keyframes crPop { 0% { transform: scale(0.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .cr-card, .cr-answer.shown b { animation: none; }
  .cr-inner { transition: none; }
}

/* the invisible copy of the clue gives the card its height, so long clues never spill out */
.cr-card { display: grid; }
.cr-size { visibility: hidden; display: block; padding: 34px 16px 18px; }
.cr-back { padding: 34px 16px 18px; }

/* AI prompt / import */
.cr-ai summary { cursor: pointer; }
.cr-aibody { margin-top: 12px; }
.cr-aiopts { display: grid; grid-template-columns: 1fr 110px 130px; gap: 10px; align-items: end; }
.cr-aiopts label { display: block; }
.cr-aiopts input { width: 100%; }
#aiPaste { width: 100%; min-height: 120px; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
#aiNote.err { color: var(--sg-red); }
@media (max-width: 560px) {
  .cr-aiopts { grid-template-columns: 1fr 1fr; }
  .cr-aitopic { grid-column: 1 / -1; }
}
#aiNote .cr-warn { color: #b45309; }
