:root {
  --bg: #130f1d;
  --card: #1f192e;
  --card-locked: #181324;
  --accent: #ff4d79;
  --accent-soft: rgba(255, 77, 121, 0.18);
  --gold: #ffd166;
  --text: #f8f5ff;
  --muted: #a69ec0;
  --radius: 18px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top, #251a3a 0%, var(--bg) 70%);
  color: var(--text);
  min-height: 100vh;
  padding: 16px 14px 36px;
}

.app-header {
  text-align: center;
  margin-bottom: 18px;
}

.app-header h1 {
  margin: 0 0 4px;
  font-size: 1.55rem;
  letter-spacing: 0.3px;
}

.app-header p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  margin: 0 auto;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 0.4s ease;
}

#progress-text {
  font-size: 0.82rem;
  color: var(--gold);
  font-weight: 700;
}

/* Grille des 24 cases */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
}

.day-tile {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease;
  overflow: hidden;
}

.day-tile:active {
  transform: scale(0.95);
}

.day-tile.locked {
  background: var(--card-locked);
  opacity: 0.55;
  cursor: not-allowed;
}

.day-tile.today {
  border: 2px solid var(--accent);
  box-shadow: 0 0 18px rgba(255, 77, 121, 0.35);
  animation: pulseBorder 2s infinite;
}

.day-tile.opened {
  border-color: rgba(255, 209, 102, 0.45);
}

.day-tile .tile-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
}

.day-tile .day-num {
  font-size: 1.3rem;
  font-weight: 800;
  z-index: 1;
}

.day-tile .day-icon {
  font-size: 0.85rem;
  margin-top: 2px;
  z-index: 1;
}

@keyframes pulseBorder {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 77, 121, 0.3); }
  50% { box-shadow: 0 0 22px rgba(255, 77, 121, 0.65); }
}

/* Modale */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 7, 18, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 100;
}

.modal.hidden, .hidden {
  display: none !important;
}

.modal-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  width: 100%;
  max-width: 420px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 0.82rem;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
}

.modal-title {
  margin: 10px 0 4px;
  font-size: 1.25rem;
}

.modal-instruction {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  position: relative;
}

/* Révélation */
.photo-frame {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(255, 209, 102, 0.4);
  animation: popIn 0.45s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.photo-frame img {
  width: 100%;
  display: block;
  max-height: 52vh;
  object-fit: cover;
}

.reveal-message {
  margin: 14px 0;
  line-height: 1.5;
  font-size: 0.98rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 14px;
  border-radius: 14px;
}

.reveal-audio {
  width: 100%;
  margin-bottom: 12px;
}

.reactions {
  display: flex;
  gap: 8px;
}

.react-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 9px 6px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.react-btn:active, .react-btn.sent {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(0.96);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: scale(1); }
}

/* --- Styles spécifiques aux mini-jeux --- */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ff758f);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

/* Bisou-mètre */
.bisou-arena {
  width: 100%;
  text-align: center;
}
.bisou-bar {
  width: 100%;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 18px;
}
.bisou-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff4d79, #ffb703);
  transition: width 0.06s linear;
}
.bisou-btn {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.2);
  background: radial-gradient(circle, #ff5c8a, #d90429);
  font-size: 3.2rem;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(217, 4, 41, 0.45);
  transition: transform 0.06s;
}
.bisou-btn:active { transform: scale(0.88); }
.floating-kiss {
  position: fixed;
  pointer-events: none;
  font-size: 1.7rem;
  animation: floatUp 0.85s ease-out forwards;
  z-index: 200;
}
@keyframes floatUp {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.8); }
  100% { opacity: 0; transform: translate(-50%, -140px) scale(1.4); }
}

/* Sudoku 9x9 */
.sudoku-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.sudoku-board {
  position: relative;
  width: 100%;
  max-width: 342px;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  border: 2px solid var(--gold);
  border-radius: 8px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.sdk-cell {
  border: 0.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(24, 19, 36, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  position: relative;
  transition: background 0.35s ease;
}
.sdk-cell.b-right { border-right: 2px solid var(--gold); }
.sdk-cell.b-bottom { border-bottom: 2px solid var(--gold); }
.sdk-cell.given { color: var(--gold); }
.sdk-cell.user-val { color: #72efdd; }
.sdk-cell.selected { background: rgba(255, 77, 121, 0.55) !important; }
.sdk-cell.same-num { background: rgba(114, 239, 221, 0.25); }
.sdk-cell.knight-threat { box-shadow: inset 0 0 0 1.5px rgba(255, 209, 102, 0.45); }
.sdk-cell.block-solved {
  background: rgba(19, 15, 29, 0.25);
  text-shadow: 0 1px 4px #000, 0 0 8px #000;
}
.sdk-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  font-size: 0.48rem;
  line-height: 1;
  color: var(--muted);
  padding: 1px;
}
.sdk-notes span {
  display: flex;
  align-items: center;
  justify-content: center;
}
.sudoku-controls {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 342px;
}
.sdk-tool {
  flex: 1;
  padding: 7px 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.sdk-tool.active {
  background: var(--accent);
  border-color: var(--accent);
}
.sudoku-numpad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  width: 100%;
  max-width: 342px;
}
.sdk-num-btn {
  aspect-ratio: 1 / 1.15;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.sdk-num-btn:active { background: var(--accent); }