/* ── PauseJeu SDK — Shared CSS ───────────────────────────────────────────────
   Inclus dans chaque jeu via <link href="sdk/sdk.css">
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Game Base ───────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Bungee&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:   #0d0d1f;
  --bg-mid:    #181830;
  --bg-light:  #1a1040;
  --gold:      #f9d342;
  --gold-dark: #e67e22;
  --green:     #2ecc71;
  --green-dark:#27ae60;
  --red:       #e74c3c;
  --blue:      #3498db;
  --text:      #f0f0fa;
  --text-dim:  rgba(255,255,255,0.55);
  --card-bg:   rgba(255,255,255,0.06);
  --border:    rgba(255,255,255,0.1);
}

body {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-mid) 50%, var(--bg-light) 100%);
  color: var(--text);
  min-height: 100vh; min-height: 100dvh;
  overflow-x: hidden;
}

body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(249,211,66,0.10), transparent),
    radial-gradient(2px 2px at 80% 20%, rgba(249,211,66,0.07), transparent),
    radial-gradient(2px 2px at 50% 80%, rgba(249,211,66,0.09), transparent),
    radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.06), transparent),
    radial-gradient(1px 1px at 70% 50%, rgba(255,255,255,0.04), transparent);
}

/* ── Animations ── */
@keyframes float       { 0%,100% { transform:translateY(0); }    50% { transform:translateY(-10px); } }
@keyframes slideUp     { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes glow        { 0%,100% { text-shadow:0 0 20px rgba(249,211,66,0.5); } 50% { text-shadow:0 0 40px rgba(249,211,66,0.9); } }
@keyframes pulse       { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
@keyframes pop         { 0% { transform:scale(0.7); opacity:0; } 60% { transform:scale(1.15); } 100% { transform:scale(1); opacity:1; } }
@keyframes dotBounce   { 0%,80%,100% { transform:scale(0); } 40% { transform:scale(1); } }
@keyframes wrongShake  { 0%,100% { transform:translateX(0); } 20% { transform:translateX(-8px); } 40% { transform:translateX(8px); } 60% { transform:translateX(-4px); } 80% { transform:translateX(4px); } }
@keyframes timerShrink { from { width:100%; } to { width:0%; } }

/* ── Screen ── */
.screen { display:none; flex-direction:column; align-items:center; min-height:100vh; min-height:100dvh; padding:60px 20px 24px; position:relative; z-index:1; }
.screen.active { display:flex; }

/* ── Typography ── */
h1.title {
  font-family: 'Bungee', cursive;
  font-size: clamp(36px, 9vw, 64px);
  color: var(--gold);
  text-shadow: 0 0 28px rgba(249,211,66,0.6), 0 2px 0 rgba(0,0,0,0.5);
  animation: glow 3s ease-in-out infinite;
  text-align: center; margin-bottom: 10px;
}
h2.section-title {
  font-family: 'Bungee', cursive;
  font-size: clamp(22px, 5vw, 36px);
  color: var(--gold);
  text-shadow: 0 0 16px rgba(249,211,66,0.4);
  text-align: center; margin-bottom: 8px;
}
.subtitle { color: var(--text-dim); text-align:center; max-width:400px; line-height:1.6; font-size:15px; }

/* ── Card ── */
.card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; backdrop-filter: blur(10px);
  width: 100%;
}

/* ── Input ── */
.input-field {
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.12);
  color: var(--text); padding: 12px 16px; border-radius: 12px;
  font-size: 16px; font-family: 'Fredoka', sans-serif; outline: none;
  width: 100%; transition: border-color 0.2s, box-shadow 0.2s;
}
.input-field:focus { border-color: var(--gold); box-shadow: 0 0 14px rgba(249,211,66,0.15); }
.input-field::placeholder { color: rgba(255,255,255,0.25); }

/* ── Buttons ── */
.btn {
  border: none; cursor: pointer; font-family: 'Fredoka', sans-serif;
  font-weight: 700; border-radius: 12px; transition: all 0.2s;
  padding: 12px 24px; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.1); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; filter: none; }
.btn-gold  { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #1a1030; }
.btn-dark  { background: rgba(255,255,255,0.09); color: var(--text); border: 1px solid rgba(255,255,255,0.14); }
.btn-dark:hover:not(:disabled) { background: rgba(255,255,255,0.14); }
.btn-green { background: linear-gradient(135deg, var(--green), var(--green-dark)); color: white; }
.btn-red   { background: linear-gradient(135deg, var(--red), #c0392b); color: white; }
.btn-full  { width: 100%; }
.btn-lg    { padding: 16px 40px; font-size: 18px; }

/* ── Room code (lobby) ── */
.room-code {
  font-family: 'Bungee', cursive;
  font-size: clamp(40px, 10vw, 60px); letter-spacing: 10px;
  color: var(--gold); animation: glow 2s ease-in-out infinite; user-select: all;
}

/* ── Divider ── */
.divider { display:flex; align-items:center; gap:12px; margin:14px 0; width:100%; }
.divider::before, .divider::after { content:''; flex:1; height:1px; background:rgba(255,255,255,0.08); }
.divider span { color:var(--text-dim); font-size:13px; }

/* ── Scores ── */
.score-row { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid rgba(255,255,255,0.05); }
.score-row:last-child { border-bottom:none; }
.score-rank { font-size:20px; min-width:28px; text-align:center; }
.score-name { flex:1; font-weight:600; }
.score-pts  { font-size:18px; font-weight:700; color:var(--gold); }

/* ── Waiting dots ── */
.waiting-dots { display:flex; gap:8px; justify-content:center; }
.waiting-dots span { width:10px; height:10px; border-radius:50%; background:var(--gold); animation:dotBounce 1.4s ease-in-out infinite; }
.waiting-dots span:nth-child(2) { animation-delay:.16s; }
.waiting-dots span:nth-child(3) { animation-delay:.32s; }

/* ── Word choice ── */
.word-choice-btn {
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 20px; border-radius:14px; border:2px solid rgba(255,255,255,0.1);
  background:rgba(255,255,255,0.05); color:var(--text);
  cursor:pointer; font-family:'Fredoka',sans-serif; font-size:18px; font-weight:700;
  transition:all 0.2s; width:100%;
}
.word-choice-btn:hover { border-color:rgba(249,211,66,0.5); background:rgba(249,211,66,0.08); transform:translateY(-2px); }
.word-letter-count { font-size:12px; color:var(--text-dim); font-weight:600; background:rgba(255,255,255,0.08); padding:2px 8px; border-radius:8px; }

/* ── Rules accordion ── */
.rules-details {
  width:100%; max-width:360px; margin-bottom:20px;
  background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08);
  border-radius:14px; overflow:hidden;
}
.rules-details summary { cursor:pointer; padding:12px 16px; font-size:14px; font-weight:700; color:var(--gold); list-style:none; display:flex; align-items:center; gap:8px; user-select:none; }
.rules-body { padding:4px 16px 14px; font-size:13px; color:rgba(255,255,255,0.78); line-height:1.7; display:flex; flex-direction:column; gap:6px; }
.rules-body .rules-title { font-weight:700; color:var(--text); margin-top:4px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width:4px; height:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.15); border-radius:2px; }

/* ── Back button ── */
.back-btn {
  position: fixed; top: 12px; left: 14px; z-index: 400;
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.75);
  padding: 6px 14px; border-radius: 20px;
  font-family: 'Fredoka', sans-serif; font-size: 13px; font-weight: 600;
  text-decoration: none; border: 1px solid rgba(255,255,255,0.15);
  transition: all 0.15s;
}
.back-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* ── Connection dot */
.connection-dot {
  position: fixed; top: 14px; right: 14px; z-index: 500;
  width: 10px; height: 10px; border-radius: 50%;
}
.connection-dot.connected    { background: #2ecc71; box-shadow: 0 0 6px #2ecc71; }
.connection-dot.disconnected { background: #e74c3c; animation: pulse 1s ease-in-out infinite; }

/* Room code badge */
.room-code-badge {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px; padding: 4px 14px; font-size: 13px; font-weight: 700;
  letter-spacing: 3px; color: var(--gold, #f1c40f); z-index: 400;
  white-space: nowrap; width: max-content;
}

/* Player items */
.player-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  animation: slideUp 0.3s ease-out both;
}
.player-item.is-me  { border-color: rgba(255,255,255,0.15); }
.player-item.offline { opacity: 0.45; }
.player-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  flex-shrink: 0;
}
.player-name { flex: 1; font-weight: 600; font-size: 15px; }

/* Badges */
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.badge-host    { background: rgba(241,196,15,0.15); color: var(--gold, #f1c40f); }
.badge-me      { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.4); }
.badge-offline { background: rgba(231,76,60,0.15); color: #e74c3c; }

/* Lobby code row */
.lobby-code-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(249,211,66,0.06); border: 1px solid rgba(249,211,66,0.15);
  margin-bottom: 8px;
}
.lobby-code-value {
  font-family: 'Bungee', cursive;
  font-size: 22px; letter-spacing: 6px; color: var(--gold, #f9d342);
  user-select: all;
}

/* Kick button */
.kick-btn {
  margin-left: auto;
  background: rgba(231,76,60,0.1); border: 1px solid rgba(231,76,60,0.3);
  color: rgba(231,76,60,0.8); border-radius: 8px; padding: 3px 9px;
  cursor: pointer; font-size: 13px; transition: background 0.15s;
}
.kick-btn:hover { background: rgba(231,76,60,0.25); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(20,20,40,0.95); color: #fff; padding: 10px 20px;
  border-radius: 20px; font-size: 14px; font-weight: 600; z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5); white-space: nowrap;
  animation: slideUp 0.25s ease-out;
}
.toast.green { background: rgba(46,204,113,0.92); }

/* Player Panel */
#playerPanelWidget {
  position: fixed; bottom: 16px; left: 16px; z-index: 150;
  display: none; /* hidden until pjShowScreen activates */
  flex-direction: column; align-items: flex-start; gap: 8px;
}
#playerPanelContent {
  width: 240px; max-width: calc(100vw - 32px); max-height: 60vh;
  background: #1a1a2e; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  flex-direction: column;
}
#playerPanelList {
  overflow-y: auto; padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 240px;
}
#playerPanelActions {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
#playerPanelBtn {
  background: rgba(255,255,255,0.10); color: var(--text, #e8e8f0);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 50px;
  padding: 9px 16px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
  font-family: inherit;
}
#playerPanelBtn:hover { background: rgba(255,255,255,0.18); transform: translateY(-1px); }
.pp-player {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
}
.pp-player.is-me  { border-color: rgba(255,255,255,0.12); }
.pp-player.offline { opacity: 0.45; }
.pp-avatar { font-size: 18px; flex-shrink: 0; }
.pp-name   { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-cancel-btn, .pp-leave-btn {
  width: 100%; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background 0.15s;
}
.pp-cancel-btn + .pp-leave-btn { margin-top: 6px; }
.pp-cancel-btn {
  background: rgba(231,76,60,0.12); border: 1px solid rgba(231,76,60,0.3); color: #e74c3c;
}
.pp-cancel-btn:hover { background: rgba(231,76,60,0.25); }
.pp-leave-btn {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.7);
}
.pp-leave-btn:hover { background: rgba(255,255,255,0.12); }

/* Chat widget */
#chatWidget {
  position: fixed; bottom: 16px; right: 16px; z-index: 150;
  display: none; /* hidden until pjShowScreen activates */
  flex-direction: column; align-items: flex-end; gap: 8px;
}
#chatPanel {
  width: 300px; max-width: calc(100vw - 32px);
  background: #1a1a2e; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
}
#chatMessages {
  height: 200px; overflow-y: auto; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.chat-msg { font-size: 13px; line-height: 1.4; word-break: break-word; }
.chat-msg .chat-author { font-weight: 700; color: var(--gold, #f1c40f); }
.chat-msg.is-me .chat-author { color: var(--green, #2ecc71); }
.chat-msg .chat-text { color: var(--text, #e8e8f0); }
.chat-msg.system { color: var(--text-dim, #8888aa); font-style: italic; font-size: 12px; }
#chatInputRow {
  padding: 8px 10px; border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; gap: 6px; align-items: center;
}
#chatToggleBtn {
  background: linear-gradient(135deg, var(--gold, #f1c40f), #d4a017);
  color: #1a1a2e; border: none; border-radius: 50px;
  padding: 10px 18px; font-size: 14px; font-weight: 700;
  cursor: pointer; box-shadow: 0 4px 16px rgba(241,196,15,0.3);
  transition: all 0.2s; display: flex; align-items: center; gap: 6px;
}
#chatToggleBtn:hover { filter: brightness(1.1); transform: translateY(-1px); }
#chatUnread {
  background: #e74c3c; color: white; border-radius: 50%;
  width: 18px; height: 18px; font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}

/* Chat desktop sidebar */
@media (min-width: 768px) {
  #chatWidget {
    position: fixed; right: 0; top: 0; bottom: 0; width: 300px;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #1a1a2e; border-left: 1px solid rgba(255,255,255,0.12);
    box-shadow: -4px 0 20px rgba(0,0,0,0.4);
  }
  #chatPanel {
    display: flex !important; flex: 1; border-radius: 0; border: none;
    box-shadow: none; background: none; width: auto; max-width: none;
  }
  #chatMessages { height: auto; flex: 1; }
  #chatToggleBtn { display: none !important; }
  #chatUnread    { display: none !important; }
  body.has-chat .screen.active { padding-right: 316px; }
}

/* Avatar picker */
.avatar-picker-wrap  { margin-bottom: 14px; }
.avatar-picker-label { font-size: 13px; color: var(--text-dim, #888); margin-bottom: 8px; }
.avatar-picker-grid  { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.avatar-option {
  width: 38px; height: 38px; border-radius: 10px; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 2px solid transparent;
  background: rgba(255,255,255,0.05); transition: all 0.15s;
}
.avatar-option:hover  { border-color: rgba(255,255,255,0.2); }
.avatar-option.active { border-color: var(--gold, #f1c40f); background: rgba(241,196,15,0.1); }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06); color: var(--text, #e8e8f0);
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.stepper-btn:hover { background: rgba(255,255,255,0.12); }
.stepper-val { font-weight: 700; min-width: 28px; text-align: center; font-size: 15px; }

/* Animations */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); }
}
