/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #1a2a4a;
  --primary-light: #2a3f6e;
  --accent: #f5a623;
  --accent-light: #ffd080;
  --correct: #27ae60;
  --correct-bg: #e8f8f0;
  --incorrect: #e74c3c;
  --incorrect-bg: #fde8e8;
  --riku: #3498db;
  --riku-light: #5dade2;
  --riku-bg: #eaf4fd;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #e0e4ec;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 48px);
  -webkit-tap-highlight-color: transparent;
}

/* ===== Screen Management ===== */
.screen {
  display: none;
  min-height: 100dvh;
  padding: 20px 16px;
  max-width: 480px;
  margin: 0 auto;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.app-header {
  padding: 20px 0 16px;
}

.header-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
}

.header-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.app-brand {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-bottom: 2px;
}

.brand-luna {
  color: #27ae60;
}

.brand-riku {
  color: var(--accent);
}

.app-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.header-right {
  display: flex;
  align-items: stretch;
}

.marubatsu-box {
  background: linear-gradient(135deg, #2a3f6e 0%, #3a5a9e 100%);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(26,42,74,0.25);
}

.marubatsu-text {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
}

.marubatsu-text .maru {
  color: #5dade2;
  font-size: 1.2rem;
  -webkit-text-stroke: 2px #5dade2;
}

.marubatsu-text .batsu {
  color: #e74c3c;
}

.challenge-text {
  color: #fff;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  margin-top: 1px;
}

/* ===== Stats Bar (Top) ===== */
.stats-bar {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.stat-card {
  position: relative;
  flex: 1;
  background: var(--card);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid #b0b8c8;
}

.stat-number {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 2px;
}

.stat-label-top {
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.stat-arrow {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 0.85rem;
  color: #9aa8bc;
  line-height: 1;
}

/* ===== Mode Selection ===== */
.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 20px 0 10px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-btn {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-user-select: none;
  user-select: none;
}

.mode-btn:active {
  transform: scale(0.97);
  border-color: var(--accent);
}

.mode-btn .mode-icon {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.mode-icon-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.mode-btn .mode-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.mode-btn .mode-count {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* Mode individual colors */
.mode-btn.mode-random {
  border-color: var(--accent);
  background: linear-gradient(135deg, #fff8ed, #fff);
}

.mode-btn.mode-rank {
  border-color: #d4a017;
  background: linear-gradient(135deg, #fef9e7, #fff);
}

.mode-btn.mode-subject {
  border-color: var(--riku);
  background: linear-gradient(135deg, var(--riku-bg), #fff);
}

.mode-btn.mode-topic {
  border-color: var(--correct);
  background: linear-gradient(135deg, #e8f8f0, #fff);
}

/* ===== Year/Subject Select ===== */
.select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subject-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.subject-tab {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text-sub);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-align: center;
}

.subject-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.subject-tab:active {
  transform: scale(0.95);
}

.select-subject-header {
  display: none;
}

.select-item {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.select-item:active {
  transform: scale(0.98);
  border-color: var(--accent);
}

.select-item .item-name {
  font-weight: 700;
  font-size: 1rem;
}

.select-item .item-count {
  font-size: 0.8rem;
  color: var(--text-light);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ===== Back Button ===== */
.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.back-btn::before {
  content: '\2190';
  font-size: 1.2rem;
}

/* ===== Quiz Screen ===== */
.next-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: stretch;
}

.quit-btn-small {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px 18px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  line-height: 1.2;
  text-align: center;
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  touch-action: manipulation;
}

.quit-btn-small .quit-label {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.7;
}

.quit-btn-small:active {
  background: var(--incorrect-bg);
  color: var(--incorrect);
  border-color: var(--incorrect);
  transform: scale(0.96);
}

.quit-link-row {
  text-align: right;
  margin-top: 8px;
}

.quit-link {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.quit-link:active {
  opacity: 1;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.quiz-counter {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.quiz-label {
  font-size: 0.75rem;
  color: var(--text-light);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 20px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 16px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.question-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.question-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.question-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eef1f8;
  color: var(--primary-light);
}

.question-text {
  font-size: 1rem;
  line-height: 1.75;
  flex: 1;
  white-space: pre-wrap;
  overflow-y: auto;
}

/* ===== Answer Buttons ===== */
.answer-area {
  margin-top: 16px;
  padding: 0 0 20px;
}

.answer-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.answer-btn {
  border: none;
  border-radius: 16px;
  padding: 20px;
  font-size: 2.2rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}

.answer-btn:active {
  transform: scale(0.95);
}

.answer-btn.btn-maru {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: #fff;
}

.answer-btn.btn-batsu {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
}

.answer-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

/* ===== Feedback ===== */
.feedback {
  display: none;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  animation: fadeSlideIn 0.3s ease;
}

.feedback.show {
  display: block;
}

.feedback.correct {
  background: var(--correct-bg);
  border: 2px solid var(--correct);
}

.feedback.incorrect {
  background: var(--incorrect-bg);
  border: 2px solid var(--incorrect);
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.feedback-icon {
  font-size: 1.4rem;
}

.feedback-title {
  font-size: 1rem;
  font-weight: 800;
}

.feedback.correct .feedback-title {
  color: var(--correct);
}

.feedback.incorrect .feedback-title {
  color: var(--incorrect);
}

.feedback-explanation {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.next-btn {
  flex: 1;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.next-btn:active {
  transform: scale(0.98);
  background: var(--primary-light);
}

/* ===== Result Screen ===== */
.result-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 16px;
}

.result-circle {
  width: 160px;
  height: 160px;
  margin: 0 auto 16px;
  position: relative;
}

.result-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.result-circle .circle-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 10;
}

.result-circle .circle-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.result-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--primary);
}

.result-percentage span {
  font-size: 1rem;
  color: var(--text-light);
}

.result-score {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 4px;
}

.result-points {
  font-size: 0.95rem;
  color: #f39c12;
  font-weight: 700;
  margin: 6px 0 2px;
  display: none;
}

.result-message {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* Subject breakdown */
.result-breakdown {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.breakdown-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 12px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.breakdown-label {
  font-size: 0.8rem;
  font-weight: 600;
  width: 90px;
  flex-shrink: 0;
}

.breakdown-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.breakdown-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
}

.breakdown-value {
  font-size: 0.8rem;
  font-weight: 700;
  width: 45px;
  text-align: right;
  flex-shrink: 0;
}

/* Wrong questions list */
.wrong-list {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.wrong-list-header {
  padding: 14px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}

.wrong-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.wrong-item:last-child {
  border-bottom: none;
}

.wrong-item:active {
  background: var(--bg);
}

.wrong-item-id {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.wrong-item-text {
  font-size: 0.85rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wrong-item-detail {
  display: none;
  margin-top: 8px;
  padding: 10px;
  background: var(--incorrect-bg);
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.wrong-item.expanded .wrong-item-detail {
  display: block;
}

/* Result action buttons */
.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.result-btn {
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.result-btn:active {
  transform: scale(0.97);
}

.result-btn.primary {
  background: var(--primary);
  color: #fff;
}

.result-btn.secondary {
  background: var(--border);
  color: var(--text);
}

/* ===== Weak mode banner ===== */
.weak-banner {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 10px 0;
  display: none;
  cursor: pointer;
  transition: all 0.2s;
}

.weak-banner:active {
  transform: scale(0.98);
}

.weak-banner.show {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weak-icon {
  font-size: 1.4rem;
}

.weak-info .weak-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.weak-info .weak-count {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ===== Diagnosis Banner (Top Screen) ===== */
.diagnosis-banner {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border: 2px solid #81c784;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.diagnosis-banner:active {
  transform: scale(0.98);
}

.diagnosis-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  clip-path: circle(46%);
}

.diagnosis-info .diagnosis-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.diagnosis-info .diagnosis-desc {
  font-size: 0.75rem;
  color: var(--text-light);
}

.diagnosis-arrow {
  margin-left: auto;
  font-size: 1.4rem;
  color: #81c784;
  font-weight: 700;
}

/* ===== Diagnosis Screen ===== */
.diagnosis-header {
  text-align: center;
  padding: 12px 0 16px;
}

.diagnosis-header-icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.diagnosis-header-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--primary);
}

/* Luna Message */
.luna-message {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.luna-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  clip-path: circle(46%);
}

.luna-bubble {
  background: var(--card);
  border: 1px solid #c8e6c9;
  border-radius: 0 12px 12px 12px;
  padding: 12px 14px;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
  box-shadow: var(--shadow);
  flex: 1;
}

/* Subject Tabs */
.subject-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.subject-tab {
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  transition: all 0.2s;
}

.subject-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.subject-tab:active {
  transform: scale(0.95);
}

/* Radar Chart */
.radar-container {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}

#radar-canvas {
  max-width: 100%;
  height: auto;
}

/* Topic List */
.topic-list-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 10px;
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

/* トピックセクションヘッダー */
.topic-section-header {
  margin-top: 16px;
  margin-bottom: 6px;
  padding: 0 4px;
}
.topic-section-header:first-child { margin-top: 0; }
.topic-section-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
}
.topic-section-sub {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* 頻出バッジ */
.freq-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
}
.freq-badge.freq-s {
  background: #fff3e0;
  color: #e65100;
}
.freq-badge.freq-a {
  background: #e3f2fd;
  color: #1565c0;
}

/* データ不足トピック */
.topic-insufficient {
  opacity: 0.6;
}

.topic-row {
  background: var(--card);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  gap: 10px;
}

.topic-rank {
  font-size: 0.75rem;
  font-weight: 900;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.topic-rank.danger { background: var(--incorrect); }
.topic-rank.warn { background: var(--accent); }
.topic-rank.good { background: var(--correct); }

.topic-info {
  flex: 1;
  min-width: 0;
}

.topic-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-detail {
  font-size: 0.7rem;
  color: var(--text-light);
}

.topic-bar-bg {
  width: 60px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.topic-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.topic-pct {
  font-size: 0.8rem;
  font-weight: 700;
  width: 38px;
  text-align: right;
  flex-shrink: 0;
}

/* Diagnosis Summary */
.diagnosis-summary {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.summary-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 10px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.summary-item {
  text-align: center;
  padding: 10px;
  background: var(--bg);
  border-radius: 8px;
}

.summary-value {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--primary);
}

.summary-label {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 2px;
}

.summary-alert {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fff3e0;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #e65100;
  text-align: center;
}

/* ===== Mission Banner ===== */
.mission-banner {
  background: var(--card);
  border: 2px solid var(--riku);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 10px 0;
  box-shadow: var(--shadow);
}

.mission-banner.completed {
  border-color: var(--riku);
  background: linear-gradient(135deg, var(--riku-bg), #fff);
}

.mission-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.mission-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  clip-path: circle(46%);
}

.mission-title-area {
  flex: 1;
}

.mission-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.08em;
}

.mission-title {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--primary);
}

.mission-difficulty {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 2px;
}
.mission-difficulty.diff-1 {
  color: #27ae60;
  background: #e8f8f0;
}
.mission-difficulty.diff-2 {
  color: #e67e22;
  background: #fef5e7;
}
.mission-difficulty.diff-3 {
  color: #e74c3c;
  background: #fdedec;
}

.mission-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--riku);
  color: #fff;
  white-space: nowrap;
}

.mission-banner.completed .mission-badge {
  background: linear-gradient(135deg, var(--riku), var(--riku-light));
  cursor: pointer;
  transition: transform 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: badge-glow 2s ease-in-out infinite;
}

.mission-banner.completed .mission-badge:active {
  transform: scale(0.92);
}

@keyframes badge-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4); }
  50% { box-shadow: 0 0 12px 4px rgba(52, 152, 219, 0.3); }
}

.mission-desc {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.mission-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.mission-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--riku), var(--riku-light));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.mission-banner.completed .mission-progress-fill {
  background: linear-gradient(90deg, var(--riku), var(--riku-light));
}

.mission-progress-text {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-light);
  text-align: right;
}

/* ===== Confetti ===== */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  animation: confetti-burst var(--duration, 2s) cubic-bezier(0.22, 0.6, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes confetti-burst {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx, 0px), var(--ty, 200px)) rotate(var(--rot, 720deg)) scale(0.2);
  }
}

/* ===== Rank Selection ===== */
.rank-intro {
  background: linear-gradient(135deg, #eef1f8 0%, #f8f9fd 100%);
  border: 2px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  text-align: center;
}

.jin-speech-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.jin-bubble {
  position: relative;
  background: #fff;
  border: 2px solid #d4a017;
  border-radius: 12px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #333;
  white-space: nowrap;
}


.rank-intro-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.rank-intro-text {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 10px;
}

.rank-progress {
  margin-top: 6px;
}

.rank-progress-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.rank-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.rank-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--correct));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.rank-item {
  flex-wrap: wrap;
}

.rank-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.rank-stars {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.rank-desc {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 1px;
}

.rank-item.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.rank-hint {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.6;
  padding: 12px;
  text-align: center;
  background: #fffbe6;
  border-radius: 10px;
  border: 1px solid #f5e6a3;
  margin-top: 8px;
}

/* ===== Animations ===== */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.pop {
  animation: pop 0.3s ease;
}

/* ===== Scrollbar ===== */
.question-text::-webkit-scrollbar {
  width: 4px;
}

.question-text::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ===== Desktop ===== */
@media (min-width: 481px) {
  .screen {
    padding: 24px;
  }

  .answer-btn {
    padding: 24px;
    font-size: 2.6rem;
  }
}

/* ===== Access Control ===== */
.mode-btn.locked {
  position: relative;
  opacity: 0.5;
}
.mode-btn.locked::after {
  content: '🔒';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 1rem;
}

.weak-banner.locked,
.diagnosis-banner.locked {
  opacity: 0.5;
  position: relative;
}
.weak-banner.locked::after,
.diagnosis-banner.locked::after {
  content: '🔒 有料版';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: #999;
  background: rgba(255,255,255,0.9);
  padding: 2px 8px;
  border-radius: 10px;
}

.trial-badge {
  text-align: center;
  padding: 8px 16px;
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  color: #e65100;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 12px;
  margin: 0 16px 8px;
}

/* Upgrade Modal */
.upgrade-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.upgrade-modal.show {
  display: flex;
}
.upgrade-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.upgrade-content {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 340px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.upgrade-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #999;
  cursor: pointer;
}
.upgrade-header {
  text-align: center;
  margin-bottom: 16px;
}
.upgrade-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}
.upgrade-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--primary);
}
.upgrade-features {
  margin-bottom: 16px;
}
.upgrade-feature {
  padding: 8px 0;
  font-size: 0.9rem;
  color: #444;
  border-bottom: 1px solid #f0f0f0;
}
.upgrade-price {
  text-align: center;
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 16px;
}
.upgrade-price strong {
  font-size: 1.8rem;
  color: var(--accent);
}
.upgrade-btn-stores {
  display: block;
  text-align: center;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #e8941a);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 12px;
  text-decoration: none;
  margin-bottom: 16px;
}
.upgrade-divider {
  text-align: center;
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 12px;
  position: relative;
}
.upgrade-divider::before,
.upgrade-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 20%;
  height: 1px;
  background: #ddd;
}
.upgrade-divider::before { left: 0; }
.upgrade-divider::after { right: 0; }
.upgrade-code-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.upgrade-code-input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
}
.upgrade-code-input:focus {
  outline: none;
  border-color: var(--accent);
}
.upgrade-code-btn {
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.upgrade-code-btn-large {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 8px;
}
.upgrade-code-btn-large:active {
  opacity: 0.8;
}
.upgrade-code-btn:disabled,
.upgrade-code-btn-large:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.upgrade-code-msg {
  text-align: center;
  font-size: 0.85rem;
  min-height: 1.2em;
}

/* Activation Toast */
.activation-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 16px 24px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  z-index: 2000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  transition: transform 0.4s ease;
  max-width: 90%;
}
.activation-toast.show {
  transform: translateX(-50%) translateY(0);
}
.activation-toast.success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 2px solid #66bb6a;
}
.activation-toast.error {
  background: #fff3e0;
  color: #e65100;
  border: 2px solid #ffb74d;
}

/* ===== Feedback Link ===== */
.feedback-link {
  text-align: center;
  padding: 16px 0 24px;
  color: #888;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.2s;
}
.feedback-link:hover, .feedback-link:active {
  color: #1a2a4a;
}
.feedback-icon {
  font-size: 1rem;
}

.app-footer {
  text-align: center;
  padding: 12px 0 32px;
  font-size: 0.75rem;
  color: #aaa;
}
.app-footer a {
  color: #999;
  text-decoration: none;
}
.app-footer a:hover {
  color: #666;
  text-decoration: underline;
}

/* ===== Feedback Modal ===== */
.feedback-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  padding: 16px;
}
.feedback-overlay.show { opacity: 1; }

.feedback-modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
}
.feedback-modal h3 {
  font-size: 1.1rem;
  color: #1a2a4a;
  margin-bottom: 16px;
  text-align: center;
}
.feedback-rating {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.feedback-rating-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.2s;
}
.feedback-rating-btn.selected {
  border-color: #f39c12;
  background: #fef9e7;
  transform: scale(1.15);
}
.feedback-rating-label {
  text-align: center;
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 16px;
}
.feedback-textarea {
  width: 100%;
  min-height: 100px;
  border: 2px solid #ddd;
  border-radius: 10px;
  padding: 12px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 16px;
}
.feedback-textarea:focus {
  outline: none;
  border-color: #3498db;
}
.feedback-email {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: inherit;
  margin-bottom: 16px;
}
.feedback-email:focus {
  outline: none;
  border-color: #3498db;
}
.feedback-submit {
  width: 100%;
  padding: 12px;
  background: #1a2a4a;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.feedback-submit:disabled {
  background: #ccc;
}
.feedback-close {
  width: 100%;
  padding: 10px;
  background: none;
  border: none;
  color: #888;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
}
.feedback-thanks {
  text-align: center;
  padding: 20px 0;
}
.feedback-thanks .check {
  font-size: 3rem;
  margin-bottom: 12px;
}
.feedback-thanks p {
  color: #666;
  font-size: 0.95rem;
}

/* ===== Stat Card Tappable ===== */
.stat-tappable {
  cursor: pointer;
  transition: transform 0.15s;
}

.stat-tappable:active {
  transform: scale(0.95);
}

/* ===== Stats Detail Panel ===== */
.stats-detail-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  margin: 0 0 4px;
}

.stats-detail-panel.open {
  max-height: 1000px;
}

.stats-detail-inner {
  background: var(--card);
  border: 2px solid #b0b8c8;
  border-radius: var(--radius);
  padding: 16px;
}

.stats-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stats-detail-title {
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--primary);
}

.stats-detail-close {
  font-size: 0.85rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
}

.stats-detail-section {
  margin-bottom: 12px;
}

.stats-detail-section:last-child {
  margin-bottom: 0;
}

.stats-detail-section-title {
  font-size: 0.78rem;
  font-weight: 900;
  color: #fff;
  margin-top: 16px;
  margin-bottom: 8px;
  padding: 7px 10px;
  background: var(--primary);
  border-radius: 6px;
}

.stats-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
}

.stats-detail-label {
  font-size: 0.8rem;
  color: var(--text);
}

.stats-detail-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

/* ===== Coin Point Display ===== */
.stat-coin {
  cursor: pointer;
  transition: transform 0.15s;
}

.stat-coin:active {
  transform: scale(0.95);
}

.stat-coin-correct {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
}

.stat-coin-correct span {
  font-weight: 900;
}

.stat-label-coin {
  font-size: 0.6rem;
  color: var(--primary);
  font-weight: 700;
  margin-top: 1px;
}

.coin {
  width: 56px;
  height: 56px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f7d94e, #d4a017);
  box-shadow:
    0 2px 4px rgba(0,0,0,0.15),
    inset 0 2px 3px rgba(255,255,255,0.4),
    inset 0 -2px 3px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 2.5px solid #c8960c;
  overflow: hidden;
}

.coin::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25);
}

.coin-number {
  font-size: 1.15rem;
  font-weight: 900;
  color: #5a3e00;
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  z-index: 1;
}

/* キラッと光るアニメーション */
@keyframes coin-shine {
  0%, 85% { left: -50%; }
  100% { left: 150%; }
}

.coin::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -50%;
  width: 30%;
  height: 110%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.5),
    transparent
  );
  transform: skewX(-20deg);
  z-index: 2;
  animation: coin-shine 4s ease-in-out infinite;
}

/* 4桁以上は文字サイズ縮小 */
.coin.digits-4 .coin-number { font-size: 0.75rem; }
.coin.digits-5 .coin-number { font-size: 0.65rem; }

/* ===== Points Detail Panel ===== */
.points-detail-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  margin: 0 0 4px;
}

.points-detail-panel.open {
  max-height: 800px;
}

.points-detail-inner {
  background: linear-gradient(135deg, #3a3d4a, #4a4e5e);
  border-radius: var(--radius);
  padding: 16px;
  color: #fff;
}

.points-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.points-detail-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1c40f;
}

.points-detail-close {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  padding: 4px 8px;
}

.points-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.points-detail-label {
  font-size: 0.8rem;
  color: #fff;
}

.points-detail-value {
  font-size: 0.85rem;
  font-weight: 700;
}

.points-highlight {
  color: #f1c40f;
}

.points-detail-row-current {
  margin: 8px 0;
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,0.15);
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.points-current {
  font-size: 1.3rem;
  font-weight: 900;
  color: #f7d94e;
}

.points-detail-section {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  font-weight: 700;
  margin: 12px 0 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.points-detail-bar-area {
  margin: 8px 0 10px;
}

.points-detail-bar {
  height: 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 5px;
  overflow: hidden;
}

.pd-master-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}

.points-detail-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f39c12, #f1c40f);
  border-radius: 5px;
  transition: width 0.6s ease;
}

.points-detail-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: rgba(255,255,255,0.35);
  margin-top: 3px;
}

.points-detail-bar-pct {
  font-size: 0.7rem;
  color: #f1c40f;
  text-align: right;
  margin-top: 2px;
}

.points-detail-rules {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.7;
}

/* ===== 問診 (Monshin) ===== */
.monshin-panel {
  margin: 0 0 16px;
}

.monshin-input-area {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.monshin-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 2px solid #b0b8c8;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.monshin-input-area .monshin-btn {
  flex-shrink: 0;
}

.monshin-input:focus {
  border-color: var(--luna-green, #27ae60);
}

.monshin-preset-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.monshin-preset-label {
  font-size: 0.8rem;
  color: var(--text-light);
}

.monshin-preset {
  padding: 8px 14px;
  background: #fff;
  border: 2px solid #b0b8c8;
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.monshin-preset:active {
  background: #f0f7f0;
  border-color: var(--luna-green, #27ae60);
}

.monshin-btn {
  padding: 10px 20px;
  background: var(--luna-green, #27ae60);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.monshin-btn-next,
.monshin-btn-start {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 1rem;
}

.monshin-btn-start {
  background: var(--primary);
}

.monshin-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.monshin-choice {
  padding: 12px 16px;
  background: #fff;
  border: 2px solid #b0b8c8;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.monshin-choice:active {
  background: #f0f7f0;
  border-color: var(--luna-green, #27ae60);
}

.monshin-choice-sub {
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 0.8rem;
  text-align: center;
  margin-top: 8px;
  padding: 8px;
}

.monshin-books {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.monshin-book {
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e0e4ea;
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.5;
}

.monshin-complete {
  margin-top: 16px;
  text-align: left;
}

.monshin-complete-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* 問診記録 */
.monshin-review {
  margin: 0 0 12px;
}

.monshin-review-toggle {
  font-size: 0.8rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 6px 0;
}

.monshin-review-content {
  background: #fff;
  border: 1px solid #e0e4ea;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 6px;
}

.monshin-review-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid #f0f3f7;
}

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

/* ===== Data Link ===== */
.data-link {
  text-align: center;
  padding: 10px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  margin: 4px 0;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.data-link:active {
  background: rgba(26, 42, 74, 0.06);
}

.data-link-icon {
  margin-right: 4px;
}

/* ===== Welcome Overlay (初回訪問者のみ) ===== */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.welcome-overlay.show {
  display: flex;
}
.welcome-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(26,42,74,0.85), rgba(52,152,219,0.85));
  backdrop-filter: blur(4px);
}
.welcome-content {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px 24px;
  max-width: 360px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}
.welcome-avatars {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}
.welcome-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: contain;
  border: 3px solid var(--card);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.welcome-avatar-luna { border-color: #c8e6c9; }
.welcome-avatar-riku { border-color: var(--riku-light); }
.welcome-greeting {
  font-size: 1.0rem;
  color: var(--text);
  margin-bottom: 14px;
  font-weight: 600;
}
.welcome-brand {
  font-weight: 900;
  font-size: 1.25rem;
  margin-bottom: 16px;
  color: var(--primary);
}
.welcome-brand-luna { color: #4caf50; }
.welcome-brand-riku { color: var(--riku); }
.welcome-brand-sub {
  display: block;
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 700;
  margin-top: 2px;
}
.welcome-tagline {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}
.welcome-features {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  text-align: left;
}
.welcome-features li {
  font-size: 0.92rem;
  color: var(--text);
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.welcome-check {
  color: var(--correct);
  font-weight: 900;
  font-size: 1.05rem;
}
.welcome-features strong {
  color: var(--primary);
  font-weight: 800;
}
.welcome-checked {
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
  padding: 8px 0;
  margin: 0 8px 14px;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  letter-spacing: 0.02em;
}
.welcome-trial {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  color: #e65100;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 18px;
}
.welcome-cta-primary {
  display: block;
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent), #f7b955);
  color: #fff;
  font-size: 1.0rem;
  font-weight: 800;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245,166,35,0.35);
  margin-bottom: 10px;
  touch-action: manipulation;
}
.welcome-cta-primary:active {
  transform: translateY(1px);
}
.welcome-cta-secondary {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  color: var(--text-light);
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  touch-action: manipulation;
}
.welcome-cta-secondary:active {
  color: var(--text);
}
