/* Bearhug English Activities - custom styles (Tailwind 외 추가 스타일) */

body { box-sizing: border-box; margin: 0; }

.slide-in { animation: slideIn 0.4s ease-out; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bombShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px) rotate(-5deg); } 75% { transform: translateX(10px) rotate(5deg); } }
@keyframes bombPulse { 0% { transform: scale(0.5); opacity: 0; } 50% { transform: scale(1.3); } 100% { transform: scale(1); opacity: 1; } }
@keyframes matchSuccess { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.match-animation { animation: matchSuccess 0.5s ease-in-out; }

.nav-button-active { transform: scale(1.05); outline: 3px solid #c4b5fd; }

/* Welcome cards */
.welcome-card {
  display: flex; align-items: center; gap: 0.9rem;
  width: 100%; padding: 0.9rem 1.1rem; border-radius: 1rem;
  background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: left; transition: transform 0.15s ease, box-shadow 0.15s ease; cursor: pointer;
}
.welcome-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.12); }

/* ---- Memory game (3D flip) ---- */
#game-board { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
.mem-card { perspective: 900px; aspect-ratio: 1 / 0.68; cursor: pointer; }
.mem-inner { position: relative; width: 100%; height: 100%; transition: transform 0.45s ease; transform-style: preserve-3d; }
.mem-card.flipped .mem-inner { transform: rotateY(180deg); }
.mem-face {
  position: absolute; inset: 0; border-radius: 0.75rem; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.mem-back { background: #3b82f6; color: white; font-size: 2.25rem; font-weight: 700; transition: box-shadow 0.2s; }
.mem-card:hover .mem-back { box-shadow: 0 10px 20px rgba(0,0,0,0.25); }
.mem-front { background: white; transform: rotateY(180deg); padding: 0.5rem; text-align: center; color: #1e293b; }
.mem-front.text { font-size: clamp(1rem, 2.4vw, 1.6rem); font-weight: 700; overflow-wrap: anywhere; }
.mem-front.emoji { font-size: clamp(2.5rem, 6vw, 4rem); }
.mem-front img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 0.5rem; }
.mem-card.matched { cursor: default; }
.mem-card.matched .mem-front { background: #dcfce7; box-shadow: inset 0 0 0 4px #10b981, 0 4px 10px rgba(0,0,0,0.15); }

/* ---- Ladder ---- */
.ladder-line { transition: stroke 0.3s ease; }
.participant-name { cursor: pointer; transition: all 0.3s ease; transform-origin: center; }
.participant-name:hover { font-weight: 900; filter: brightness(1.2); }

/* ---- Sentence builder (slot) ---- */
.slot-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); }
@media (max-width: 640px) { .slot-grid { grid-template-columns: 1fr; } }
.slot-reel {
  height: 120px; overflow: hidden; position: relative; border-radius: 12px; background: white;
  box-shadow: inset 0 4px 8px rgba(0,0,0,0.2); display: flex; align-items: center; justify-content: center;
}
.slot-word {
  padding: 0 0.75rem; text-align: center; font-weight: 700; overflow-wrap: anywhere;
  font-size: clamp(1.4rem, 3.2vw, 2.2rem); transition: transform 0.15s ease;
}
.slot-word.spinning { filter: blur(1.5px); color: #64748b; }
.slot-word.landed { animation: matchSuccess 0.4s ease-in-out; color: #1d4ed8; }
.sentence-result {
  min-height: 4.5rem; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.6rem); font-weight: 800; color: #1d4ed8;
  background: white; border-radius: 1rem; box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 1rem 1.5rem; margin-bottom: 2rem; overflow-wrap: anywhere;
}

/* ---- Word scramble ---- */
.scrambled-letter {
  transition: all 0.3s ease; cursor: pointer; width: 70px; height: 90px; background: white;
  border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: bold; margin: 0 4px; user-select: none;
}
@media (max-width: 480px) { .scrambled-letter { width: 52px; height: 68px; font-size: 1.8rem; } }
.scrambled-letter:hover { transform: translateY(-8px) rotate(-2deg); box-shadow: 0 8px 20px rgba(0,0,0,0.25); }
.letter-selected {
  background: #3b82f6 !important; color: white !important;
  transform: translateY(-5px) scale(1.05); box-shadow: 0 8px 20px rgba(59,130,246,0.4);
}

/* ---- Wheel ---- */
.wheel-container { position: relative; width: min(400px, 82vw); aspect-ratio: 1 / 1; margin: 0 auto; }
.wheel-canvas { width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 8px 24px rgba(0,0,0,0.3); display: block; }
.wheel-pointer {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%); width: 0; height: 0;
  border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 40px solid #ef4444;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); z-index: 10;
}

/* ---- Scoreboard ---- */
.scoreboard-sidebar {
  position: fixed; top: 0; left: 0; width: min(350px, 88vw); height: 100%; z-index: 40;
  box-shadow: 4px 0 12px rgba(0,0,0,0.2); transition: transform 0.3s ease-in-out; background: white;
}
.scoreboard-sidebar.closed { transform: translateX(-100%); box-shadow: none; }
.scoreboard-toggle {
  position: absolute; top: 90px; right: -40px; width: 40px; height: 80px; background: #f59e0b; color: white;
  border-radius: 0 12px 12px 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; transition: right 0.2s ease; box-shadow: 2px 0 8px rgba(0,0,0,0.2); border: 0;
}
.scoreboard-toggle:hover { right: -43px; }
.scoreboard-sidebar.closed .scoreboard-toggle { box-shadow: 2px 0 8px rgba(0,0,0,0.3); }

/* ---- Saved sets bar ---- */
.sets-bar { margin-bottom: 1.5rem; }
.sets-card { background: white; border-radius: 1rem; box-shadow: 0 10px 25px rgba(0,0,0,0.1); padding: 1.25rem 1.5rem; }

/* ---- Toast ---- */
#toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 0.7rem 1.2rem; border-radius: 0.75rem; color: white; font-weight: 600; box-shadow: 0 6px 16px rgba(0,0,0,0.25); animation: fadeIn 0.25s ease-out; transition: opacity 0.3s; }
.toast-ok { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-out { opacity: 0; }

input[type="text"], input[type="email"], input[type="password"], select, textarea { background: white; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
