:root {
  --bg-color: #f4f6f9;
  --card-bg: #ffffff;
  --text-primary: #2d3748;
  --text-secondary: #718096;
  --primary-color: #3182ce;
  --success-color: #38a169;
  --danger-color: #e53e3e;
  --border-radius: 12px;
  --box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.app-container {
  width: 100%;
  max-width: 540px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--box-shadow);
}

.view-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hidden { display: none !important; }

/* TOP画面ヘッダー */
.top-header {
  text-align: center;
  border-bottom: 2px solid #edf2f7;
  padding-bottom: 12px;
}

.top-header h1 { font-size: 1.5rem; }
.top-header .subtitle { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }

/* 単語帳グリッド */
.deck-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.deck-card {
  display: flex;
  align-items: center;
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.deck-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.15);
}

.deck-card-icon {
  font-size: 1.8rem;
  margin-right: 14px;
}

.deck-card-info { flex: 1; }
.deck-card-info h3 { font-size: 1.1rem; color: var(--text-primary); }
.deck-card-info .deck-progress { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }

.deck-card-arrow {
  font-size: 1rem;
  color: var(--primary-color);
  font-weight: bold;
}

/* 学習画面ヘッダー */
.study-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #edf2f7;
  padding-bottom: 12px;
}

.study-header h2 { font-size: 1.2rem; }

.btn-back {
  background: #edf2f7;
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
}
.btn-back:hover { background: #e2e8f0; }

.stats {
  display: flex;
  justify-content: space-around;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: #edf2f7;
  padding: 8px 12px;
  border-radius: 8px;
}
.stats strong { color: var(--primary-color); }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; text-align: center; font-weight: bold; }
.alert.danger { background-color: #fed7d7; color: #9b2c2c; }
.alert.success { background-color: #c6f6d5; color: #22543d; }

/* 3Dカード */
.card-wrapper { perspective: 1000px; height: 220px; }
.card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.4s ease; cursor: pointer; }
.card.is-flipped { transform: rotateY(180deg); }
.card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: var(--border-radius); border: 2px solid #e2e8f0; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; background-color: #ffffff; text-align: center; }
.card-face .label { position: absolute; top: 10px; left: 14px; font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; }
.card-content { font-size: 1.6rem; font-weight: bold; }
.card-back { transform: rotateY(180deg); background-color: #f7fafc; color: #2b6cb0; }

.controls { display: flex; flex-direction: column; gap: 10px; }
.answer-buttons { display: flex; gap: 10px; }
.btn { padding: 12px; font-size: 0.95rem; font-weight: bold; border: none; border-radius: 8px; cursor: pointer; width: 100%; }
.btn-secondary { background-color: #e2e8f0; color: #4a5568; }
.btn-danger { background-color: var(--danger-color); color: white; flex: 1; }
.btn-success { background-color: var(--success-color); color: white; flex: 1; }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px dashed #cbd5e0; font-size: 0.85rem; padding: 8px; }
