body {
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background: #eef2f6;
  color: #333;
  margin: 0;
  padding: 15px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  box-sizing: border-box;
}

main {
  background: #fff;
  margin-top: 20px;
  padding: 30px 25px 40px;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 500px;
  box-sizing: border-box;
}

.list-page {
  max-width: 760px;
}

.title-page {
  text-align: center;
  margin-top: 10vh;
}

.title-page h1 {
  font-size: 1.8em;
  color: #0070A8;
  margin-bottom: 10px;
}

.subtitle {
  color: #666;
  margin-bottom: 40px;
}

#mode-select {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  width: 100%;
}

.mode-btn {
  font-size: 1.3em;
  font-weight: bold;
  padding: 18px 0;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  width: 95%;
  color: white;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s;
}

.mode-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

.normal-mode { background: linear-gradient(135deg, #0070A8 0%, #005885 100%); }
.resume-mode {
  background: #fff;
  border: 2px solid #0070A8;
  color: #005f8a;
}
.review-mode { background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%); }
.ta-mode { background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%); }
.archive-mode {
  background: linear-gradient(135deg, #6a5a21 0%, #4d4219 100%);
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
}

.progress-panel {
  background: #f4f8fb;
  border: 1px solid #d9e6ef;
  border-radius: 10px;
  color: #24546d;
  font-size: 0.95em;
  line-height: 1.6;
  margin: 0 0 24px;
  padding: 12px 14px;
}

#timer-bar {
  font-size: 1.8em;
  font-weight: bold;
  color: #d32f2f;
  text-align: center;
  margin-bottom: 25px;
  padding: 10px;
  background-color: #ffebee;
  border-radius: 10px;
  border: 2px solid #ffcdd2;
}

.penalty-flash { animation: flashRed 0.3s ease; }

@keyframes flashRed {
  0% { background-color: #ff0000; color: white; }
  100% { background-color: #ffebee; color: #d32f2f; }
}

#question-number {
  font-weight: bold;
  color: #0070A8;
  margin-bottom: 15px;
  font-size: 1.1em;
}

#question-text {
  white-space: pre-wrap;
  line-height: 1.8;
  margin-bottom: 40px;
  color: #222;
  font-size: 1.2em;
  font-weight: 500;
}

#choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 25px;
}

.choice {
  font-size: 2.2em;
  font-weight: bold;
  padding: 15px 0;
  border: 3px solid #0070A8;
  border-radius: 12px;
  background-color: #fff;
  color: #0070A8;
  cursor: pointer;
  box-shadow: 0 5px 0 #005F8A;
  transition: all 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.choice:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #005F8A;
}

.choice:disabled,
#unknown-btn:disabled {
  cursor: default;
  opacity: 0.65;
}

.choice:disabled:active {
  box-shadow: 0 5px 0 #005F8A;
  transform: none;
}

#unknown-btn:disabled:active {
  box-shadow: 0 4px 0 #bbb;
  transform: none;
}

#unknown-btn {
  grid-column: 1 / span 2;
  font-size: 1.1em;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background-color: #e0e0e0;
  color: #555;
  font-weight: bold;
  box-shadow: 0 4px 0 #bbb;
  cursor: pointer;
}

#unknown-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

#controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 30px;
}

#next-btn {
  width: 100%;
  font-size: 1.1em;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(to bottom, #0070A8, #005F8A);
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 95, 138, 0.3);
}

#next-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

#home-btn,
.secondary-btn {
  width: 100%;
  font-size: 1em;
  padding: 14px;
  border: 2px solid #ccc;
  border-radius: 10px;
  background-color: #fff;
  color: #666;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 3px 0 #ddd;
}

#home-btn:active,
.secondary-btn:active {
  transform: translateY(2px);
  box-shadow: none;
  background: #f9f9f9;
}

.list-header {
  margin-bottom: 22px;
}

.list-header h1 {
  color: #0070A8;
  font-size: 1.65em;
  margin: 0 0 8px;
}

.list-header p {
  color: #666;
  line-height: 1.6;
  margin: 0;
}

.list-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  margin-bottom: 22px;
}

.list-action-btn {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  padding: 13px 10px;
}

.list-action-primary {
  background: #0070A8;
  color: #fff;
}

.list-action-secondary {
  background: #fff;
  border: 1px solid #bbb;
  color: #555;
}

.list-action-link {
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 20px;
}

.legend-item {
  align-items: center;
  color: #555;
  display: inline-flex;
  font-size: 0.85em;
  gap: 5px;
}

.legend-dot {
  border: 1px solid #aaa;
  border-radius: 3px;
  height: 12px;
  width: 12px;
}

.year-section {
  border-bottom: 1px solid #dce5eb;
  padding: 4px 0;
}

.year-section summary {
  color: #174d68;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: bold;
  list-style-position: outside;
  padding: 15px 4px;
}

.year-summary-count {
  color: #6d7d85;
  font-size: 0.82em;
  font-weight: normal;
  margin-left: 8px;
}

.question-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 0 16px;
}

.question-group {
  border: 1px solid #dbe3e8;
  border-radius: 8px;
  padding: 10px;
}

.question-group-title {
  color: #444;
  font-size: 0.9em;
  font-weight: bold;
  margin-bottom: 8px;
}

.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.question-link {
  align-items: center;
  border: 1px solid #9aaab3;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-weight: bold;
  justify-content: center;
  min-height: 36px;
  min-width: 38px;
  padding: 4px 8px;
}

.status-unanswered { background: #fff; color: #24546d; }
.status-correct { background: #dff2e2; border-color: #7db386; color: #24602c; }
.status-wrong { background: #fde2e2; border-color: #d58b8b; color: #9b2424; }

.resume-position {
  box-shadow: 0 0 0 3px #f0b429;
}

.list-error {
  color: #a02727;
  line-height: 1.6;
  padding: 20px 0;
}

@media (max-width: 560px) {
  .list-page {
    margin-top: 0;
    padding: 22px 16px 32px;
  }

  .question-grid {
    grid-template-columns: 1fr;
  }

  .list-actions {
    grid-template-columns: 1fr;
  }
}

#result {
  font-size: 1.5em;
  font-weight: bold;
  margin: 20px 0;
  height: 1.5em;
  text-align: center;
}

.feedback-area {
  margin: 14px 0 0;
  text-align: center;
}

.feedback-open-btn {
  background: transparent;
  border: 0;
  color: #71818a;
  font-size: 0.82em;
  min-height: 44px;
  margin: 0;
  padding: 8px 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  width: auto;
}

.feedback-open-btn:hover {
  background: transparent;
  color: #3f5966;
  transform: none;
}

.feedback-form {
  background: #f8fbfd;
  border: 1px solid #d7e3ea;
  border-radius: 10px;
  padding: 12px;
  text-align: left;
}

.feedback-form label {
  color: #44545c;
  display: block;
  font-weight: bold;
  margin-bottom: 7px;
}

.feedback-form textarea {
  border: 1px solid #aebdc5;
  border-radius: 8px;
  box-sizing: border-box;
  font: inherit;
  padding: 10px;
  resize: vertical;
  width: 100%;
}

.feedback-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
}

.feedback-actions button {
  margin: 0;
}

.feedback-status {
  color: #44545c;
  font-size: 0.9em;
  margin: 8px 0 0;
}

@media (max-width: 560px) {
  .feedback-actions {
    grid-template-columns: 1fr;
  }
}

#progress-info {
  margin-top: 30px;
  font-size: 0.9em;
  text-align: center;
  color: #888;
  line-height: 1.6;
}

#final-result-area {
  text-align: center;
  padding-top: 20px;
}

.ta-title {
  color: #d32f2f;
  font-size: 2em;
  margin-bottom: 30px;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 40px;
}

.ta-wrong-review {
  margin: 0 0 28px;
  text-align: left;
}

.ta-wrong-review h3 {
  color: #314a57;
  font-size: 1.15em;
  margin: 0 0 12px;
}

.ta-wrong-review-list {
  display: grid;
  gap: 12px;
}

.ta-wrong-card {
  background: #f8fbfd;
  border: 1px solid #d7e3ea;
  border-radius: 12px;
  padding: 14px;
}

.ta-wrong-card h4 {
  color: #006a9f;
  font-size: 1em;
  margin: 0 0 9px;
}

.ta-wrong-question {
  color: #263238;
  line-height: 1.7;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.ta-wrong-answers {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  margin: 13px 0 0;
}

.ta-wrong-answers div {
  background: #fff;
  border: 1px solid #dce5eb;
  border-radius: 8px;
  padding: 9px 10px;
}

.ta-wrong-answers dt {
  color: #697981;
  font-size: 0.78em;
  margin-bottom: 3px;
}

.ta-wrong-answers dd {
  color: #263238;
  font-size: 1.25em;
  font-weight: bold;
  margin: 0;
}

.ta-all-correct {
  background: #edf8ef;
  border: 1px solid #b9ddbf;
  border-radius: 10px;
  color: #24642d;
  margin: 0;
  padding: 14px;
  text-align: center;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 1em;
  color: #666;
}

.stat-value {
  font-size: 2.5em;
  font-weight: bold;
  color: #333;
}

#ta-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

@media (max-width: 560px) {
  .ta-title {
    font-size: 1.65em;
    margin-bottom: 22px;
  }

  .result-stats {
    gap: 14px;
    margin-bottom: 28px;
  }

  .stat-box {
    min-width: 0;
    width: 50%;
  }

  .ta-wrong-answers {
    grid-template-columns: 1fr 1fr;
  }
}

.control-btn {
  font-size: 1.1em;
  padding: 15px;
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.control-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.blue-btn { background: #0070A8; }
.black-btn { background: #000; }
.gray-btn { background: #888; }

.hidden { display: none !important; }

footer {
  margin-top: 50px;
  color: #888;
  font-size: 0.85em;
  border-top: 1px solid #eee;
  padding-top: 20px;
}

footer a {
  color: #0070A8;
  text-decoration: none;
}

.privacy-link-row {
  font-size: 0.85em;
  margin-top: 28px;
  text-align: center;
}

.privacy-link-row a {
  color: #607984;
}

/* questions.json から生成する年度別・問題別の検索用ページ */
.seo-page {
  max-width: 880px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.breadcrumbs li {
  color: #687983;
  font-size: 0.86em;
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 6px;
}

.breadcrumbs a,
.seo-page a {
  color: #006b9d;
}

.seo-header {
  border-bottom: 1px solid #dce5eb;
  margin-bottom: 28px;
  padding-bottom: 22px;
}

.seo-header h1 {
  color: #0070A8;
  font-size: clamp(1.55rem, 4.5vw, 2.15rem);
  line-height: 1.45;
  margin: 6px 0 12px;
}

.seo-header p,
.seo-context p,
.seo-choice-text,
.seo-note {
  line-height: 1.85;
}

.seo-eyebrow {
  color: #56717f;
  font-size: 0.88em;
  font-weight: bold;
  letter-spacing: 0.05em;
  margin: 0;
}

.seo-page h2 {
  color: #174d68;
  font-size: 1.25em;
}

.seo-year-grid,
.seo-question-list {
  display: grid;
  gap: 12px;
  list-style: none;
  min-width: 0;
  padding: 0;
}

.seo-question-list li,
.seo-question-list a {
  min-width: 0;
}

.seo-year-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.seo-year-grid a,
.seo-question-list a {
  background: #f8fbfd;
  border: 1px solid #d7e3ea;
  border-radius: 10px;
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  text-decoration: none;
}

.seo-year-grid a {
  flex-direction: column;
}

.seo-year-grid span,
.seo-choice-count {
  color: #6d7d85;
  font-size: 0.86em;
}

.seo-question-number {
  flex: 0 0 48px;
  font-weight: bold;
}

.seo-question-preview {
  color: #44545c;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seo-choice-count {
  flex: 0 0 auto;
  white-space: nowrap;
}

.seo-context {
  background: #f4f8fb;
  border-left: 4px solid #0070A8;
  border-radius: 8px;
  margin-bottom: 24px;
  padding: 14px 18px;
}

.seo-context h2 {
  margin-top: 0;
}

.seo-choice-card {
  border: 1px solid #dbe3e8;
  border-radius: 12px;
  margin-bottom: 16px;
  padding: 18px;
}

.seo-choice-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.seo-choice-heading h2 {
  margin: 0;
}

.seo-label,
.seo-source,
.seo-note {
  color: #697a83;
  font-size: 0.88em;
}

.seo-answer {
  background: #edf7ed;
  border-radius: 7px;
  display: inline-block;
  margin-bottom: 4px;
  padding: 7px 12px;
}

.seo-answer span {
  color: #1d6b2b;
  font-size: 1.2em;
  font-weight: bold;
}

.seo-cta-row,
.seo-prev-next {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.seo-primary-link,
.seo-secondary-link {
  border-radius: 9px;
  display: inline-block;
  font-weight: bold;
  padding: 12px 16px;
  text-decoration: none;
}

.seo-primary-link {
  background: #0070A8;
  color: #fff !important;
}

.seo-secondary-link {
  background: #fff;
  border: 1px solid #aebdc5;
}

.seo-prev-next {
  border-top: 1px solid #dce5eb;
  justify-content: space-between;
  padding-top: 20px;
}

.seo-footer {
  line-height: 1.65;
}

.seo-footer a {
  color: #607984;
}

.privacy-page section {
  margin-bottom: 30px;
}

.privacy-list {
  line-height: 1.8;
  padding-left: 1.4em;
}

@media (max-width: 560px) {
  .seo-page {
    border-radius: 12px;
    margin-top: 0;
    padding: 22px 16px 32px;
  }

  .seo-year-grid {
    grid-template-columns: 1fr;
  }

  .seo-question-list a {
    align-items: start;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 12px;
  }

  .seo-question-preview {
    display: -webkit-box;
    overflow-wrap: anywhere;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .seo-choice-card {
    padding: 15px;
  }

  .seo-cta-row,
  .seo-prev-next {
    flex-direction: column;
  }

  .seo-primary-link,
  .seo-secondary-link {
    text-align: center;
  }
}
