:root {
  /* カラーシステム */
  --bg-base: #FAF8F2;
  --surface-card: #FFFFFF;
  --surface-sub: #FCFAF5;
  --text-main: #141B22;
  --text-muted: #586573;
  --accent-gold: #C59B27;
  --accent-gold-dark: #A27B17;
  --accent-gold-light: #FDFBF3;
  --accent-gold-glow: rgba(197, 155, 39, 0.15);
  --border-light: rgba(20, 27, 34, 0.08);
  --border-gold: rgba(197, 155, 39, 0.35);
  --success: #0D6E42;
  --success-bg: #EAF7F0;
  --success-border: #9AD6B6;
  --error: #A62639;
  --error-bg: #FDF0F2;
  --error-border: #F1B5BE;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 16px 36px -8px rgba(45, 35, 20, 0.05), 0 4px 12px -2px rgba(20, 27, 34, 0.02);
  --shadow-btn: 0 4px 12px rgba(20, 27, 34, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background-image: 
    radial-gradient(circle at 85% 15%, rgba(245, 225, 170, 0.22) 0%, transparent 55%),
    radial-gradient(circle at 15% 85%, rgba(240, 215, 150, 0.18) 0%, transparent 65%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='sandNoise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.02 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23sandNoise)'/%3E%3C/svg%3E"),
    linear-gradient(165deg, #FDFCF7 0%, #FAF6EA 50%, #F4ECE0 100%);
  background-attachment: fixed;
}

.app-container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* 折り畳み式ヘッダーナビゲーション */
#nav-toggle {
  display: none;
}

.site-nav {
  background: var(--surface-card);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 10px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-btn);
  position: relative;
}

.nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold-dark);
  background: var(--accent-gold-light);
  border: 1px solid var(--border-gold);
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

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

/* ドロップダウンメニュー部 */
.nav-list {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-gold);
}

/* チェック時に滑らかに展開 */
#nav-toggle:checked ~ .nav-list {
  display: flex;
  animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-item {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-main);
  background-color: var(--accent-gold-light);
  border: 1px solid var(--border-gold);
}

/* カードデザイン */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: 30px 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-gold);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-gold), #E8CF82, var(--accent-gold));
}

.en-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: var(--accent-gold);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 6px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 900;
  text-align: center;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 0.85rem;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 24px;
  font-weight: 500;
}

/* ボタンコンポーネント */
.btn {
  width: 100%;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  box-shadow: var(--shadow-btn);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #1E2732 0%, #141B22 100%);
  color: #FFFFFF;
  border: 1px solid var(--accent-gold);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2A3645 0%, #1E2732 100%);
  box-shadow: 0 6px 20px rgba(20, 27, 34, 0.2);
}

.btn-primary:disabled {
  background: #CBD2D9;
  border-color: transparent;
  box-shadow: none;
  color: #7B8794;
  cursor: not-allowed;
}

.btn-outline {
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--accent-gold);
  background-color: var(--accent-gold-light);
}

.btn-outline:disabled {
  background: #CBD2D9;
  border-color: transparent;
  box-shadow: none;
  color: #7B8794;
  cursor: not-allowed;
}

.btn-danger-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
  background-color: var(--surface-card);
  color: var(--error);
  border: 1px solid var(--error-border);
  border-radius: 20px;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-danger-sm:hover {
  background-color: var(--error-bg);
}

/* 画面切り替え */
.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ローディング表示 */
.loading-box {
  text-align: center;
  padding: 40px 0;
}

.spinner {
  border: 3px solid var(--border-light);
  border-top: 3px solid var(--accent-gold);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* カテゴリー選択UI */
.mode-group {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.category-section {
  background-color: var(--surface-sub);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
}

.category-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 同じカテゴリー選択パネル内で「級」を区切るための控えめな仕切り線 */
.category-section-title-sub {
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-light);
}

.category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 2px;
  margin-bottom: 16px;
}

.category-grid::-webkit-scrollbar {
  width: 4px;
}
.category-grid::-webkit-scrollbar-thumb {
  background: var(--border-gold);
  border-radius: 4px;
}

.category-chip {
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.category-chip:hover {
  border-color: var(--accent-gold);
  background-color: var(--accent-gold-light);
}

.category-chip.selected {
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-dark) 100%);
  color: #FFFFFF;
  border-color: var(--accent-gold-dark);
  box-shadow: 0 4px 10px var(--accent-gold-glow);
  transform: translateY(-1px);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* プレイ画面 */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.badge {
  background-color: var(--surface-card);
  color: var(--text-main);
  border: 1px solid var(--border-gold);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background-color: rgba(20, 27, 34, 0.06);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), #E0BA55);
  width: 0%;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.question-meta {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-gold-dark);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.question-text {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.65;
  color: var(--text-main);
  margin-bottom: 24px;
  white-space: pre-wrap;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background-color: var(--surface-card);
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  line-height: 1.45;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.option-btn:not(:disabled):hover {
  border-color: var(--accent-gold);
  background-color: var(--accent-gold-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--accent-gold-glow);
}

.option-key {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--text-main);
  color: var(--accent-gold);
  border-radius: var(--radius-sm);
  padding: 2px 9px;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: all 0.2s;
}

.option-btn.correct {
  border-color: var(--success-border) !important;
  background-color: var(--success-bg) !important;
  color: var(--success) !important;
  font-weight: 700;
}
.option-btn.correct .option-key {
  background-color: var(--success) !important;
  color: #FFFFFF !important;
}

.option-btn.incorrect {
  border-color: var(--error-border) !important;
  background-color: var(--error-bg) !important;
  color: var(--error) !important;
}
.option-btn.incorrect .option-key {
  background-color: var(--error) !important;
  color: #FFFFFF !important;
}

.option-btn:disabled {
  cursor: default;
}

.explanation-card {
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius-md);
  background-color: var(--surface-sub);
  border: 1px solid var(--border-gold);
  display: none;
}

.explanation-card.active {
  display: block;
  animation: fadeInUp 0.3s ease-out;
}

.result-status {
  font-size: 1.15rem;
  font-weight: 900;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-status.correct { color: var(--success); }
.result-status.incorrect { color: var(--error); }

.explanation-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-gold-dark);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.explanation-body {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-main);
  white-space: pre-wrap;
  font-weight: 400;
}

.next-btn-container {
  margin-top: 20px;
  display: none;
}

/* リザルト画面 */
.score-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFFFFF 0%, var(--accent-gold-light) 100%);
  border: 3px solid var(--accent-gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 24px auto;
  box-shadow: 0 10px 25px var(--accent-gold-glow);
}

.score-rate {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.score-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-gold-dark);
  letter-spacing: 0.1em;
  margin-top: 6px;
}

.result-detail {
  display: flex;
  justify-content: space-around;
  margin: 24px 0;
  padding: 20px 12px;
  background-color: var(--surface-sub);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.result-item {
  text-align: center;
}

.result-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
}

.result-item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 4px;
}

/* サービス案内・プライバシーポリシー用追加CSS */
.section-box {
  background-color: var(--surface-sub);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px 18px;
  margin-bottom: 20px;
}

.section-box:last-of-type {
  margin-bottom: 0;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-gold-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid var(--border-gold);
  padding-bottom: 6px;
}

.section-block {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.section-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-gold-dark);
  margin-bottom: 10px;
}

p {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-main);
  margin-bottom: 10px;
}

.roadmap-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.roadmap-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface-card);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.roadmap-badge {
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-dark) 100%);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
  margin-top: 2px;
}

.roadmap-content {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.5;
}

.roadmap-desc {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 3px;
}

.btn-youtube {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
  color: #FFFFFF;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.25);
  transition: all 0.2s ease;
  margin-top: 14px;
}

.btn-start, .btn-back {
  width: 100%;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--accent-gold);
  background: linear-gradient(135deg, #1E2732 0%, #141B22 100%);
  color: #FFFFFF;
  text-decoration: none;
  box-shadow: var(--shadow-btn);
  margin-top: 10px;
}

/* フッター */
.app-footer {
  margin-top: 10px;
  text-align: center;
  padding: 16px 8px 24px;
  border-top: 1px dashed var(--border-gold);
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-policy-btn {
  color: var(--accent-gold-dark);
  font-weight: 700;
  text-decoration: underline;
}

.prohibition-notice {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.copyright {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  color: var(--text-main);
}

/* 運営者情報 */
.profile-box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--accent-gold);
  box-shadow: 0 4px 10px var(--accent-gold-glow);
}

.profile-body {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.profile-desc {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 0;
}