/* resources/word-game/game.css */

.confetti-square {
  position: fixed;
  width: 8px;
  height: 8px;
  pointer-events: none;
  z-index: 9010;
}

#word-game-container {
  font-family: system-ui, sans-serif;
  max-width: 700px;
  width: 100%;
  box-sizing: border-box;
  margin: 2rem auto;
  padding: 0 1rem;
  user-select: none;
}

/* ── Loading screen ─────────────────────────────────────────────────── */
#wg-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 1rem;
}

#wg-loading-text {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.wg-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #000;
  border-top-color: transparent;
  animation: wg-spin 0.7s linear infinite;
}

@keyframes wg-spin {
  to { transform: rotate(360deg); }
}

/* ── Top bar ────────────────────────────────────────────────────────── */
#wg-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

#wg-cog-btn {
  background: none;
  border: 2px solid #000;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#wg-cog-btn:hover {
  background: #000;
  color: #fff;
}

#wg-level-info {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#wg-level-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#wg-prev-btn,
#wg-next-nav-btn {
  background: none;
  border: 2px solid #000;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

#wg-prev-btn:hover,
#wg-next-nav-btn:hover {
  background: #000;
  color: #fff;
}

/* ── Axis ───────────────────────────────────────────────────────────── */
#wg-axis-area {
  margin-bottom: 2rem;
}

#wg-poles {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.wg-pole {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

#wg-axis-bar-wrap {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
}

#wg-axis-line {
  width: 100%;
  height: 3px;
  background: #000;
}

/* True-position dots revealed after submit */
.wg-true-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #000;
  border-radius: 50%;
  transform: translateX(-50%);
  top: 50%;
  margin-top: -6px;
}

.wg-true-dot.correct { background: #008000; }
.wg-true-dot.wrong   { background: #FF0000; }

/* ── Order hint ─────────────────────────────────────────────────────── */
#wg-order-hint {
  text-align: center;
  font-size: 0.72rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

/* ── Word cards ─────────────────────────────────────────────────────── */
#wg-cards {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: nowrap;
  margin-bottom: 1.5rem;
  min-height: 56px;
  touch-action: none;
}

.word-card {
  border: 2px solid #000;
  background: #fff;
  padding: 10px 12px;
  font-size: clamp(0.55rem, 2.5vw, 0.85rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: grab;
  white-space: nowrap;
  touch-action: none;
  position: relative;
  flex-shrink: 1;
  min-width: 0;
}

.word-card:active { cursor: grabbing; }
.word-card.correct { border-color: #008000; color: #008000; }
.word-card.wrong   { border-color: #FF0000; color: #FF0000; }

/* ── Axis word labels (revealed after submit) ───────────────────────── */
#wg-axis-labels {
  position: relative;
  height: 56px;
  margin-bottom: 0.2rem;
}

.wg-axis-label {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.wg-axis-label.lane-1 {
  bottom: 26px;
}

/* ── Submit button ──────────────────────────────────────────────────── */
#wg-submit {
  display: block;
  width: 100%;
  padding: 12px;
  background: #000;
  color: #fff;
  border: 2px solid #000;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  margin-bottom: 1.5rem;
}

#wg-submit:hover { background: #fff; color: #000; }
#wg-submit:disabled { opacity: 0.4; cursor: default; }

/* ── Score panel ────────────────────────────────────────────────────── */
#wg-score-panel {
  border: 2px solid #000;
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: none;
}

#wg-score-main {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

#wg-score-detail {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #555;
}

#wg-next-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: #fff;
  color: #000;
  border: 2px solid #000;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  margin-top: 0.75rem;
}

#wg-next-btn:hover { background: #000; color: #fff; }

/* ── Concept selector modal ─────────────────────────────────────────── */
#wg-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wg-modal {
  background: #fff;
  border: 2px solid #000;
  max-width: 500px;
  width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

#wg-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #000;
}

#wg-modal-title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

#wg-modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}

#wg-modal-list {
  overflow-y: auto;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.wg-concept-btn {
  border: 2px solid #000;
  background: #fff;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-align: center;
}

.wg-concept-btn:hover { background: #000; color: #fff; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .word-card {
    padding: clamp(4px, 1.5vw, 8px) clamp(3px, 1.2vw, 6px);
  }
  #wg-cards {
    gap: clamp(3px, 1vw, 8px);
  }
  #wg-modal-list {
    grid-template-columns: 1fr;
  }
}
