/* Flashcard 3D flip animation */
.flashcard-container {
  perspective: 1000px;
  min-height: 440px;
  max-height: 500px;
  height: 460px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flashcard-container.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
}

/* 画像の最大サイズ制限 - ボタンを覆わないように */
.flashcard-front img,
.flashcard-back img {
  max-height: 130px !important;
  max-width: 200px !important;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* クイズ画像の最大サイズ */
#quiz-image {
  max-height: 110px !important;
  max-width: 180px !important;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* 画像コンテナの固定高さ */
#card-image-container,
#card-back-image-container {
  height: 140px;
  width: 100%;
}

#quiz-image-container {
  height: 120px;
  width: 100%;
}

.flashcard-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 18% 18%, rgba(255,255,255,0.18), transparent 24%),
    linear-gradient(135deg, #2563eb 0%, #7c3aed 52%, #db2777 100%);
}

.definition-stack {
  display: grid;
  gap: 0.75rem;
}

.definition-panel {
  border-radius: 0.9rem;
  padding: 0.9rem 1rem;
  text-align: center;
}

.english-panel {
  background: rgba(255, 255, 255, 0.96);
  color: #1f2937;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

.japanese-panel {
  background: rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.panel-label {
  color: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  opacity: 0.66;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.definition-text {
  font-size: clamp(1rem, 2vw, 1.28rem);
  line-height: 1.45;
  font-weight: 750;
}

.hint-toggle {
  border: 1px solid #d1d5db;
  background: white;
  color: #374151;
  border-radius: 9999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.18s ease;
}

.hint-toggle:hover {
  border-color: #6366f1;
  color: #4338ca;
}

.hint-toggle.is-off {
  background: #f3f4f6;
  color: #6b7280;
}

.vibe-filter-btn {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  border-radius: 0.75rem;
  padding: 0.72rem 0.8rem;
  text-align: left;
  font-weight: 750;
  transition: all 0.18s ease;
}

.vibe-filter-btn:hover,
.vibe-filter-btn.active {
  border-color: #6366f1;
  background: #eef2ff;
  color: #3730a3;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.13);
}

.vibe-filter-btn strong {
  color: #6b7280;
  font-size: 0.78rem;
}

.vibe-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
}

.vibe-badge[data-vibe="positive"] {
  background: #dcfce7;
  color: #166534;
}

.vibe-badge[data-vibe="negative"] {
  background: #fee2e2;
  color: #991b1b;
}

.vibe-badge[data-vibe="abstract"] {
  background: #e0e7ff;
  color: #3730a3;
}

.vibe-badge[data-vibe="concrete"] {
  background: #fef3c7;
  color: #92400e;
}

.vibe-badge-light,
.flashcard-back .vibe-badge {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #3730a3 !important;
}

/* Quiz choice buttons */
.choice-btn {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  text-align: left;
  font-size: 1rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
}

.choice-btn:hover:not(:disabled) {
  border-color: #6366f1;
  background: #eef2ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.choice-btn:disabled {
  cursor: not-allowed;
}

.choice-btn.correct {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

.choice-btn.wrong {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

/* Level cards */
.level-card {
  cursor: pointer;
  transition: all 0.3s ease;
}

.level-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* Word list rows */
.word-row {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s ease;
}

.word-row:hover {
  background: #f9fafb;
}

.word-row:last-child {
  border-bottom: none;
}

.known-badge {
  background: #d1fae5;
  color: #065f46;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* クリック可能な絵文字 (写真がある場合) */
.clickable-emoji {
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease;
}

.clickable-emoji:hover {
  transform: scale(1.15);
}

/* 「写真を見る」インジケーター */
.clickable-emoji::after {
  content: '📷';
  position: absolute;
  bottom: -6px;
  right: -10px;
  font-size: 0.45em;
  background: #6366f1;
  color: white;
  border-radius: 9999px;
  padding: 4px 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  opacity: 0.85;
}

/* フラッシュカード裏面の絵文字インジケーター色を白系に */
.flashcard-back .clickable-emoji::after {
  background: white;
  color: #6366f1;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .flashcard-container {
    min-height: 430px;
    max-height: 470px;
    height: 440px;
  }
  .flashcard-front img,
  .flashcard-back img {
    max-height: 100px !important;
    max-width: 160px !important;
  }
  #card-image-container,
  #card-back-image-container {
    height: 96px;
  }
  #quiz-image {
    max-height: 90px !important;
    max-width: 150px !important;
  }
  #quiz-image-container {
    height: 100px;
  }
  .vibe-filter-btn {
    grid-template-columns: auto 1fr;
    padding: 0.65rem;
  }
  .vibe-filter-btn strong {
    display: none;
  }
}
