/* ============================================================
   ネット安全教室 共通CSS
   ============================================================ */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, "Hiragino Sans", "Yu Gothic", sans-serif;
  background-color: #e8f4f8;
  background-image:
    repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(0,0,0,0.03) 31px, rgba(0,0,0,0.03) 32px),
    repeating-linear-gradient(90deg, transparent 0, transparent 31px, rgba(0,0,0,0.03) 31px, rgba(0,0,0,0.03) 32px);
  color: #222;
  line-height: 1.7;
  font-size: 17px;
}
ruby rt { font-size: 0.55em; }
.pixel-font { font-family: "DotGothic16", "Helvetica Neue", sans-serif; letter-spacing: 0.04em; }

/* ヘッダー */
header {
  background: #fff; border-bottom: 3px solid #1abc9c;
  padding: 12px 20px; position: sticky; top: 0; z-index: 10;
}
.header-container {
  max-width: 1000px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #222; }
.logo-img { height: 40px; }
.logo-text { font-weight: bold; font-size: 1.05rem; display: flex; flex-direction: column; line-height: 1.2; }
.logo-text-sub { font-size: 0.7rem; color: #666; }
.back-to-overview {
  background: #1abc9c; color: #fff; padding: 6px 14px;
  border-radius: 4px; text-decoration: none; font-size: 0.9rem; font-weight: bold; white-space: nowrap;
}

main { max-width: 900px; margin: 24px auto; padding: 0 16px; }

/* 共通CTA */
.cta-btn {
  font-family: "DotGothic16", sans-serif; font-size: 1rem;
  padding: 10px 20px; border: 3px solid #222; border-radius: 8px;
  background: #1abc9c; color: #fff; cursor: pointer;
  box-shadow: 3px 3px 0 #222;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
  text-decoration: none; display: inline-block;
}
.cta-btn:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 #222; }
.cta-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 #222; }
.cta-btn.secondary { background: #fff; color: #222; }
.cta-btn.danger { background: #e74c3c; color: #fff; }

/* ゲームヒーロー */
.game-hero {
  background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
  color: #fff;
  border: 3px solid #222; border-radius: 12px;
  padding: 22px; box-shadow: 4px 4px 0 #222; text-align: center;
}
.game-hero h1 {
  font-family: "DotGothic16", sans-serif; font-size: 1.7rem;
  margin: 0 0 6px; color: #fff36a; text-shadow: 2px 2px 0 #000;
}
.game-hero p { margin: 4px 0; }

/* 設定パネル */
.settings-panel {
  background: #fff; border: 3px solid #222; border-radius: 12px;
  padding: 18px 22px; box-shadow: 4px 4px 0 #222; margin-top: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.settings-panel h2 {
  font-family: "DotGothic16", sans-serif; font-size: 1.15rem;
  margin: 0; padding-bottom: 8px; border-bottom: 2px dashed #1abc9c;
}
.start-row { display: flex; justify-content: center; }

/* クイズステージ */
.quiz-stage {
  background: #fff; border: 3px solid #222; border-radius: 12px;
  padding: 18px; box-shadow: 4px 4px 0 #222; margin-top: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.quiz-progress {
  display: flex; align-items: center; gap: 12px;
}
.quiz-progress .meter {
  flex: 1; height: 16px; background: #eee;
  border: 2px solid #222; border-radius: 8px; overflow: hidden;
}
.quiz-progress .meter > span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #1abc9c, #3498db);
  transition: width 0.25s ease;
}
.quiz-progress .count {
  font-family: "DotGothic16", sans-serif; font-size: 1rem;
  white-space: nowrap;
}
.quiz-prompt {
  font-family: "DotGothic16", sans-serif;
  font-size: 1.1rem;
  background: #fff36a;
  border: 2px solid #222; border-radius: 8px;
  padding: 12px 16px;
  text-align: center; line-height: 1.5;
}
.quiz-prompt-desc {
  font-size: 0.95rem; color: #555;
  margin-top: 6px; line-height: 1.5;
  text-align: center; font-family: "Helvetica Neue", sans-serif;
}

.quiz-options {
  display: flex; flex-direction: column; gap: 8px;
}
.quiz-option {
  background: #fff;
  border: 3px solid #222; border-radius: 8px;
  padding: 12px 16px;
  font-family: "Courier New", "Consolas", monospace;
  font-size: 1.05rem;
  cursor: pointer;
  text-align: left;
  box-shadow: 3px 3px 0 #222;
  transition: transform 0.08s ease, background 0.15s ease;
  word-break: break-all;
  user-select: none;
}
.quiz-option:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 #222; background: #f0f8ff; }
.quiz-option.is-disabled { pointer-events: none; opacity: 0.7; }
.quiz-option.is-correct {
  background: #d4edda; border-color: #28a745; box-shadow: 3px 3px 0 #28a745;
}
.quiz-option.is-wrong {
  background: #f8d7da; border-color: #dc3545; box-shadow: 3px 3px 0 #dc3545;
}
.quiz-option .option-letter {
  display: inline-block;
  font-family: "DotGothic16", sans-serif;
  background: #fff36a; color: #222;
  border: 2px solid #222; border-radius: 4px;
  padding: 2px 8px; margin-right: 10px;
}
.quiz-option.is-correct .option-letter { background: #28a745; color: #fff; }
.quiz-option.is-wrong .option-letter { background: #dc3545; color: #fff; }

.quiz-explanation {
  background: #e8f4f8;
  border: 2px solid #2980b9; border-radius: 8px;
  padding: 14px;
  display: none;
}
.quiz-explanation.is-shown { display: block; }
.quiz-explanation .verdict {
  font-family: "DotGothic16", sans-serif;
  font-size: 1.1rem; margin-bottom: 6px;
}
.quiz-explanation .verdict.correct { color: #28a745; }
.quiz-explanation .verdict.wrong { color: #dc3545; }
.quiz-explanation p { margin: 0; line-height: 1.55; }

.quiz-controls {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
}

/* 結果パネル */
.results-panel {
  background: linear-gradient(180deg, #fff36a, #ffd35a);
  border: 3px solid #222; border-radius: 12px;
  padding: 22px; box-shadow: 4px 4px 0 #222;
  text-align: center; margin-top: 20px;
  display: none;
}
.results-panel.is-shown { display: block; }
.results-panel.is-fail { background: linear-gradient(180deg, #ffc4c4, #ff8888); }
.results-title { font-family: "DotGothic16", sans-serif; font-size: 1.6rem; margin: 0 0 8px; }
.results-stats {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 10px 0;
}
.results-stat {
  background: #fff; border: 2px solid #222; border-radius: 8px;
  padding: 8px 14px; font-family: "DotGothic16", sans-serif;
}
.results-stat .label { font-size: 0.75rem; color: #555; }
.results-stat .val { font-size: 1.4rem; color: #1abc9c; }
.medal-row {
  font-size: 4rem; margin: 8px 0;
  filter: drop-shadow(3px 3px 0 #222);
  animation: medal-pop 0.6s ease-out;
}
.medal-label {
  font-family: "DotGothic16", sans-serif;
  font-size: 1.2rem; margin: 0 0 8px;
}
@keyframes medal-pop {
  0% { transform: scale(0) rotate(-180deg); }
  60% { transform: scale(1.2) rotate(20deg); }
  100% { transform: scale(1) rotate(0); }
}
.new-record-msg {
  color: #e74c3c; font-family: "DotGothic16", sans-serif;
  font-size: 1.2rem; margin: 8px 0;
  animation: pulse 0.6s ease-out;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.results-actions {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 12px;
}

/* レコード */
.records-card {
  background: #fff; border: 3px dashed #f39c12;
  border-radius: 12px; padding: 16px 20px; margin-top: 20px;
}
.records-card h2 {
  font-family: "DotGothic16", sans-serif; font-size: 1.1rem; margin: 0 0 10px;
}
.records-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.records-list li {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 6px 10px; background: #fff8e1; border-radius: 6px; border: 1px solid #ddd;
}
.records-list .meta { color: #666; font-size: 0.85rem; }
.records-list .score-val {
  font-family: "DotGothic16", sans-serif; font-size: 1.2rem;
  color: #f39c12; margin-left: auto;
}
.records-list .empty { color: #888; font-style: italic; }

/* フォーカス */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 4px solid #fff36a; outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(34,34,34,0.35);
}

/* フッター */
footer {
  background: #222; color: #ddd; text-align: center;
  padding: 20px; font-size: 0.9rem; margin-top: 30px;
}
.footer-content { max-width: 900px; margin: 0 auto; }

@media (max-width: 600px) {
  .game-hero h1 { font-size: 1.4rem; }
  .quiz-prompt { font-size: 1rem; }
  .quiz-option { font-size: 0.95rem; padding: 10px 12px; }
}
