/* ══════════════════════════════════════════════════════
   06-KNOWME.CSS — KNOW ME SOCIAL QUIZ ENGINE STYLING
   Playful, energetic, premium social game design system.
   ══════════════════════════════════════════════════════ */

/* ── CREATE SEGMENT TABS (01 GREETING CARD | 02 KNOW ME) ── */
.create-segments-wrap {
  padding: 12px 18px 4px;
  background: var(--bg, #fdf6ec);
}

.create-segments {
  display: flex;
  background: #f1e2d0;
  border-radius: 50px;
  padding: 4px;
  gap: 4px;
  box-shadow: inset 0 2px 4px rgba(61, 26, 0, 0.08);
}

.create-seg-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 40px;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 900;
  color: var(--muted, #6b3a1f);
  background: transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.create-seg-btn.active {
  background: #ffffff;
  color: var(--text, #3d1a00);
  box-shadow: 0 4px 12px rgba(61, 26, 0, 0.12);
  transform: scale(1.02);
}

.create-seg-badge {
  font-size: 10px;
  background: #ff5376;
  color: #fff;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 900;
}

/* ── KNOW ME CREATOR EDITOR ── */
.km-creator-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 18px 40px;
}

@media (min-width: 900px) {
  .km-creator-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 24px;
    align-items: start;
  }
  .km-creator-preview-pane {
    position: sticky;
    top: 80px;
    display: block;
  }
}

@media (max-width: 899px) {
  .km-creator-wrap {
    padding: 8px 12px 60px;
  }
  .km-creator-preview-pane {
    display: none;
  }
}

.km-hero-card {
  background: linear-gradient(135deg, #fff0f3 0%, #fff8ea 100%);
  border: 2px solid #ffd4dc;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 6px 20px rgba(255, 83, 118, 0.08);
  position: relative;
  overflow: hidden;
}

.km-hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ff5376;
  background: rgba(255, 255, 255, 0.8);
  padding: 4px 10px;
  border-radius: 30px;
  border: 1px solid #ffccd5;
  margin-bottom: 8px;
}

.km-hero-title {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  color: var(--text, #3d1a00);
  margin-bottom: 6px;
}

.km-hero-sub {
  font-size: 13px;
  color: var(--muted, #6b3a1f);
  font-weight: 600;
  line-height: 1.4;
}

/* ── QUESTION BUILDER CARD ── */
.km-q-card {
  background: #ffffff;
  border: 2px solid var(--border, #f0dec8);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 4px 16px rgba(61, 26, 0, 0.06);
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.km-q-card:focus-within {
  border-color: var(--main, #ff5376);
  box-shadow: 0 8px 24px rgba(255, 83, 118, 0.12);
}

.km-q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.km-q-num {
  font-family: 'Fredoka One', cursive;
  font-size: 16px;
  color: var(--main, #ff5376);
  display: flex;
  align-items: center;
  gap: 6px;
}

.km-q-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.km-icon-btn {
  background: #fdf4eb;
  border: 1px solid #ebd4bd;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text, #3d1a00);
  font-weight: 800;
  transition: all 0.15s;
}

.km-icon-btn:hover {
  background: #fee7d6;
  transform: translateY(-1px);
}

.km-icon-btn.danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #ef4444;
}

.km-q-input {
  width: 100%;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 800;
  padding: 12px 14px;
  border: 2px solid #ecd8c2;
  border-radius: 14px;
  background: #fdfbf7;
  color: var(--text, #3d1a00);
  outline: none;
  transition: border-color 0.2s;
}

.km-q-input:focus {
  border-color: #ff5376;
  background: #ffffff;
}

/* ── 4 OPTIONS GRID WITH SECRET ANSWER PICKER (MOBILE-FIRST SPACIOUS DESIGN) ── */
.km-opts-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.km-opt-card {
  background: #faf5ee;
  border: 2px solid #ebd9c5;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
}

.km-opt-card:focus-within {
  border-color: #ff5376;
  background: #fffbfa;
  box-shadow: 0 4px 14px rgba(255, 83, 118, 0.1);
}

.km-opt-card.correct {
  background: #f0fdf4;
  border-color: #10b981;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.15);
}

.km-opt-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.km-opt-badge-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.km-opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ecd8c2;
  color: #3d1a00;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka One', cursive;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.km-opt-card.correct .km-opt-letter {
  background: #10b981;
  color: #ffffff;
}

.km-opt-tag {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted, #6b3a1f);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.km-opt-card.correct .km-opt-tag {
  color: #065f46;
}

.km-correct-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid #ebd4bd;
  background: #ffffff;
  color: #6b3a1f;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}

.km-correct-toggle:hover {
  background: #fdf4eb;
  border-color: #10b981;
  color: #10b981;
}

.km-correct-toggle.is-correct {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.km-correct-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background 0.2s;
}

.km-correct-toggle.is-correct .km-correct-dot {
  background: #ffffff;
}

input[type="text"].km-opt-input-full {
  width: 100% !important;
  box-sizing: border-box !important;
  display: block !important;
  padding: 12px 14px !important;
  border: 1.5px solid #ecd8c2 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  font-family: 'Nunito', sans-serif !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #3d1a00 !important;
  outline: none !important;
  transition: all 0.2s !important;
  box-shadow: 0 2px 4px rgba(61, 26, 0, 0.03) !important;
}

input[type="text"].km-opt-input-full:focus {
  border-color: #ff5376 !important;
  box-shadow: 0 0 0 3px rgba(255, 83, 118, 0.15) !important;
}

.km-opt-card.correct input[type="text"].km-opt-input-full {
  border-color: #a7f3d0 !important;
  background: #ffffff !important;
}

.km-opt-card.correct input[type="text"].km-opt-input-full:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

.km-reaction-box {
  background: #fff8f0;
  border: 1.5px dashed #f0dec8;
  border-radius: 12px;
  padding: 10px 12px;
}

.km-reaction-box label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted, #6b3a1f);
  margin-bottom: 4px;
  display: block;
}

.km-reaction-input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #3d1a00);
  outline: none;
}

/* ── ADD QUESTION BUTTON ── */
.km-add-q-btn {
  width: 100%;
  padding: 14px;
  border: 2px dashed #ff9ebb;
  background: #fff5f7;
  border-radius: 16px;
  font-family: 'Fredoka One', cursive;
  font-size: 15px;
  color: #ff5376;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.km-add-q-btn:hover {
  background: #ffe8ee;
  transform: scale(1.01);
}

/* ── PUBLIC QUIZ PLAYER OVERLAY (#knowme-viewer) ── */
#knowme-viewer {
  position: fixed;
  inset: 0;
  background: #fdf6ec;
  z-index: 99999;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  font-family: 'Nunito', sans-serif;
  color: #3d1a00;
}

#knowme-viewer.open {
  display: flex;
}

.km-play-container {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 20px;
  box-sizing: border-box;
}

/* Player Top Bar */
.km-player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.km-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f0dec8;
  border: none;
  font-size: 16px;
  font-weight: 900;
  color: #3d1a00;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.km-progress-bar-wrap {
  flex: 1;
  height: 8px;
  background: #ecd8c2;
  border-radius: 10px;
  margin: 0 16px;
  overflow: hidden;
}

.km-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff7a65, #ff5376);
  border-radius: 10px;
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.km-step-badge {
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  color: #ff5376;
}

/* Screen 1: Welcome */
.km-welcome-card {
  background: #ffffff;
  border: 2.5px solid #ebd8c4;
  border-radius: 28px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 12px 36px rgba(61, 26, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: kmPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.km-welcome-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd3dc, #ffecd2);
  border: 4px solid #ffffff;
  box-shadow: 0 8px 24px rgba(255, 83, 118, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
}

.km-welcome-title {
  font-family: 'Fredoka One', cursive;
  font-size: 26px;
  color: #3d1a00;
  line-height: 1.2;
}

.km-welcome-sub {
  font-size: 14px;
  color: #6b3a1f;
  font-weight: 700;
  max-width: 320px;
}

.km-name-input {
  width: 100%;
  padding: 14px 18px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  border: 2.5px solid #ecd8c2;
  border-radius: 16px;
  background: #fdfbf7;
  color: #3d1a00;
  text-align: center;
  outline: none;
  box-sizing: border-box;
}

.km-name-input:focus {
  border-color: #ff5376;
  background: #ffffff;
}

/* Screen 2: Question & Options */
.km-game-question-card {
  background: #ffffff;
  border: 2.5px solid #ebd8c4;
  border-radius: 28px;
  padding: 26px 20px;
  box-shadow: 0 10px 32px rgba(61, 26, 0, 0.08);
  margin-bottom: 20px;
  text-align: center;
  animation: kmSlideUp 0.3s ease-out;
}

.km-game-question-text {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  color: #3d1a00;
  line-height: 1.35;
}

.km-game-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.km-game-option-btn {
  width: 100%;
  background: #ffffff;
  border: 2px solid #e8d5c4;
  border-radius: 18px;
  padding: 16px 18px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #3d1a00;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(61, 26, 0, 0.04);
}

.km-game-option-btn:hover {
  transform: translateY(-2px);
  border-color: #ff85a1;
  box-shadow: 0 6px 18px rgba(255, 83, 118, 0.12);
}

.km-game-option-btn:active,
.km-game-option-btn.selected {
  background: linear-gradient(135deg, #fff0f3, #ffeef1);
  border-color: #ff5376;
  transform: scale(0.98);
}

.km-game-option-badge {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: #fdf3e7;
  color: #6b3a1f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.km-game-option-btn.selected .km-game-option-badge {
  background: #ff5376;
  color: #ffffff;
}

/* Screen 3: Results & Animated Reveal */
.km-results-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: kmPopIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.km-score-card {
  background: linear-gradient(145deg, #ffffff 0%, #fff7ec 100%);
  border: 3px solid #ffccd5;
  border-radius: 28px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(255, 83, 118, 0.15);
  position: relative;
  overflow: hidden;
}

.km-score-wheel {
  font-family: 'Fredoka One', cursive;
  font-size: 54px;
  color: #ff5376;
  line-height: 1;
  margin: 10px 0;
  text-shadow: 0 4px 12px rgba(255, 83, 118, 0.2);
}

.km-score-tier {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: #3d1a00;
  margin-bottom: 6px;
}

.km-rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #3d1a00;
  color: #ffd000;
  padding: 8px 18px;
  border-radius: 40px;
  font-family: 'Fredoka One', cursive;
  font-size: 15px;
  margin-top: 8px;
  box-shadow: 0 4px 14px rgba(61, 26, 0, 0.25);
}

.km-champ-banner {
  background: linear-gradient(90deg, #ffc700, #ff9900);
  color: #3d1a00;
  padding: 8px 16px;
  border-radius: 12px;
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: kmPulse 1.8s infinite;
  margin-bottom: 10px;
}

/* Leaderboard List */
.km-lb-card {
  background: #ffffff;
  border: 2px solid #ebd8c4;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(61, 26, 0, 0.05);
}

.km-lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  color: #3d1a00;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid #f0dec8;
}

.km-lb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.km-lb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #faf4ec;
  border-radius: 14px;
  font-weight: 800;
  font-size: 14px;
  color: #3d1a00;
  transition: all 0.2s;
}

.km-lb-item.current-player {
  background: #ffeef2;
  border: 2px solid #ff5376;
  transform: scale(1.02);
}

.km-lb-item.champ {
  background: #fffbe6;
  border: 1.5px solid #ffe066;
}

.km-lb-rank {
  width: 28px;
  font-family: 'Fredoka One', cursive;
  font-size: 15px;
}

/* Question Breakdown Cards */
.km-breakdown-card {
  background: #ffffff;
  border: 2px solid #ebd8c4;
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.km-breakdown-card.correct {
  border-left: 6px solid #10b981;
}

.km-breakdown-card.wrong {
  border-left: 6px solid #ef4444;
}

.km-breakdown-reaction {
  background: #fff8f0;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #8c4e28;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── SOCIAL TAB / FEED CARDS ── */
.km-social-quiz-card {
  background: #ffffff;
  border: 2px solid #ebd8c4;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 4px 16px rgba(61, 26, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.km-social-quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.km-quiz-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 800;
  color: #6b3a1f;
}

.km-quiz-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── KEYFRAME ANIMATIONS ── */
@keyframes kmPopIn {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes kmSlideUp {
  0% { transform: translateY(16px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes kmPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
