/* =========================================
   1. 全ページ共通：基本の見た目
   ========================================= */

/*study.html*/
body {
  font-family:
    "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    Meiryo, sans-serif;
  line-height: 1.8;
  color: #333;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f9f9f9;
}

.container {
  background-color: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.intro {
  padding: 15px;
  border-radius: 8px;
  font-style: italic;
}

/* 見出しの基本（色は分野別で上書き） */
h1 {
  font-size: 1.8em;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

h2 {
  padding: 10px 15px;
  margin-top: 30px;
  border-radius: 0 5px 5px 0;
}

/* 強調マーカー */
.highlight {
  background: linear-gradient(transparent 60%, #ffff99 60%);
  font-weight: bold;
}
.important {
  font-weight: bold;
}
.point-title {
  font-weight: bold;
}

.point-box {
  background: #fff9db;
  border: 5px soild #fab005;
  padding: 15px;
  margin: 20px 0;
}

.tip {
  background: #e3f9e5;
  border-left: 5px solid #2ecc71;
  padding: 15px;
  margin: 20px 0;
}

.warning {
  background: #fff5f5;
  border-left: 5px solid #ff6b6b;
  padding: 15px;
  margin: 20px 0;
}

/* 共通ボタン */
.btn-container {
  text-align: center;
  margin-top: 40px;
}

.quiz-button {
  color: white;
  padding: 16px 32px;
  text-decoration: none;
  border-radius: 50px;
  font-weight: bold;
  transition: 0.3s;
  display: inline-block;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
}

.quiz-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.1);
}

.comparison-table {
  overflow-x: auto;
  margin: 20px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  border: 1px solid #d8dadb;
  padding: 10px;
  text-align: center;
}

th {
  background-color: #f8f9fa;
}

/* =========================================
   2. 分野別の色設定（classで切り替え）
   ========================================= */

/* --- 生物 (Biology) --- */
.category-bio h1 {
  border-bottom: 4px solid #27ae60;
  color: #27ae60;
}
.category-bio h2 {
  border-left: 6px solid #27ae60;
  background: #ebf9f1;
  color: #1e8449;
}
.category-bio .intro {
  background: #efffee;
  padding: 15px;
  border-radius: 8px;
  font-size: 0.95rem;
}
.category-bio .quiz-button {
  background-color: #27ae60;
}
.category-bio .quiz-button:hover {
  background-color: #2ecc71;
}

/* --- 物理 (Physics) --- */
.category-phy h1 {
  border-bottom: 4px solid #b92929;
  color: #b92929;
}
.category-phy h2 {
  border-left: 6px solid #b92929;
  background: #faeeee;
  color: #8c2121;
}
.category-phy .intro {
  background: #fffdf0;
  padding: 15px;
  border-radius: 8px;
  font-style: italic;
}
.category-phy .quiz-button {
  background-color: #b92929;
}
.category-phy .quiz-button:hover {
  background-color: #db3434;
}

/* --- 化学 (Chemistry) --- */
.category-che h1 {
  border-bottom: 4px solid #2980b9;
  color: #2980b9;
}
.category-che h2 {
  border-left: 6px solid #2980b9;
  background: #eef0f8;
  color: #394e74;
}
.category-che .intro {
  background: #eef7ff;
  padding: 15px;
  border-radius: 8px;
  font-style: italic;
}
.category-che .quiz-button {
  background-color: #2980b9;
}
.category-che .quiz-button:hover {
  background-color: #597db6;
}

/* --- 地学 (geology) --- */
.category-geo h1 {
  border-bottom: 4px solid #e67e22;
  color: #e67e22;
}
.category-geo h2 {
  border-left: 6px solid #e67e22;
  background: #fdf5ee;
  color: #a04000;
}
.category-geo .intro {
  background: #fff5f5;
  padding: 15px;
  border-radius: 8px;
  font-style: italic;
}
.category-geo .quiz-button {
  background-color: #e67e22;
}
.category-geo .quiz-button:hover {
  background-color: #f39c12;
}

/*index.html*/
/* 全体デザイン */
* {
  box-sizing: border-box;
}

body {
  font-family:
    "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    sans-serif;
  line-height: 1.6;
  padding: 15px;
  background-color: #f0f2f5;
  color: #333;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  overflow-x: hidden;
}

h1 {
  text-align: center;
  color: #2c3e50;
  font-size: 1.4rem;
  word-wrap: break-word;
}

.container {
  background: white;
  padding: 20px;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
}

/* メニュー画面のスタイル */
ul {
  list-style: none;
  padding: 0;
}

li {
  margin: 12px 0;
  padding: 16px;
  border-radius: 12px;
  background: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

li:hover {
  background: #fdfdfd;
  transform: translateX(0px);
}

li.biology {
  border-left: 5px solid #27ae60;
}

li.chemistry {
  border-left: 5px solid #2980b9;
}

li.physics {
  border-left: 5px solid #e74c3c;
}

li.geology {
  border-left: 5px solid #f39c12;
}

li.all {
  border-left: 5px solid #7f8c8d;
}

.genre-title {
  font-weight: bold;
  font-size: 1rem;
  color: #2c3e50;
  flex-grow: 1;
  text-align: left;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.sub-btn {
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: bold;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.2s;
  text-decoration: none;
  border: none;
}

.btn-test {
  background-color: #3498db;
  color: white !important;
}

.btn-test:hover {
  background-color: #2980b9;
}

.btn-study {
  background-color: #e67e22;
  color: white !important;
}

.btn-study:hover {
  background-color: #d35400;
}

/* クイズ画面のスタイル */
#quiz-screen {
  display: none;
  text-align: center;
}

#score {
  font-weight: bold;
  color: #7f8c8d;
  margin-bottom: 10px;
}

#question {
  font-size: 1.1rem;
  font-weight: bold;
  margin: 20px 0;
  min-height: 3em;
  text-align: left;
}

.choice-btn {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 12px;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  transition: 0.2s;
}

.choice-btn:hover {
  background: #eef2f7;
  border-color: #bdc3c7;
}

#check-btn {
  display: block;
  margin-left: auto;
  margin-bottom: 10px;
  background: none;
  border: 1px solid #ccc;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.2s;
}

#check-btn:hover {
  background-color: #f8f9fa;
}

#result {
  font-size: 1.4rem;
  font-weight: bold;
  margin: 15px 0;
  height: 1.5em;
}

#next-btn {
  display: none;
  width: 100%;
  padding: 12px;
  background: #2c3e50;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

#back-btn {
  margin-top: 20px;
  background: none;
  border: none;
  color: #3498db;
  text-decoration: underline;
  cursor: pointer;
}

#rank-message {
  display: none;
  margin-top: 15px;
  padding: 15px;
  background: #fff3cd;
  border-radius: 10px;
  color: #856404;
  font-weight: bold;
  font-size: 1.1rem;
  line-height: 1.5;
  white-space: pre-wrap;
  border: 2px dashed #ffeeba;
}

#record-screen table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  background-color: #fff;
}

#record-screen th,
#record-screen td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: center;
  font-size: 0.9rem;
}

#record-screen th {
  background-color: #f8f9fa;
  color: #2c3e50;
}

#reset-init-area {
  display: none;
  margin-top: 20px;
}

.reset-btn {
  margin: 20px auto;
  padding: 15px 20px;
  background-color: #e74c3c;
  color: white;
  border: none;
  border-radius: 8px;
  width: 90%;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  display: block;
  -webkit-appearance: none;
  appearance: none;
}

#confirm-area {
  display: none;
  background: #fff0f0;
  border: 2px solid #e74c3c;
  padding: 15px;
  border-radius: 10px;
  margin-top: 10px;
}

#custom-toast {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 15px 25px;
  border-radius: 30px;
  z-index: 99999;
  font-weight: bold;
  text-align: center;
  min-width: 200px;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#progress-container {
  width: 100%;
  background: #ddd;
  height: 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  overflow: hidden;
  display: block;
}

#progress-bar {
  width: 0%;
  background: #27ae60;
  height: 100%;
  transition: width 0.3s ease-in-out;
}

#floating-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: #4caf50;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

#footer-menu {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.menu-item {
  padding: 10px 20px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.menu-item:last-child {
  border-bottom: none;
}

/*ヘッダー*/
/* --- ヘッダー全体のレイアウト --- */
.site-header {
  background-color: #4caf50;
  border-radius: 12px 12px 0 0;
  width: 100%;
}

.header-container {
  display: flex;
  flex-direction: row; /* 必ず横並び */
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 10px;
}

/* 左右のアイコンエリアの幅を固定して、中央のスペースを確保 */
.header-left,
.header-right {
  flex-basis: 45px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.header-right {
  justify-content: flex-end;
}

/* ★タイトルの自動調整：ここがポイント */
.site-title {
  flex: 1;
  margin: 0 5px;
  font-weight: bold;
  color: white;
  text-align: center;
  /* 画面幅に合わせて1.2remから0.85remの間で動的にサイズを変える */
  font-size: clamp(0.85rem, 3.8vw, 1.2rem);
  white-space: nowrap; /* 折り返さない */
  letter-spacing: -0.5px; /* 文字間をわずかに詰めて一行に収める */
}

/* ボタンの見た目 */
#notification-btn,
#sound-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: white;
  padding: 5px;
  display: flex;
  align-items: center;
}

/* お知らせドット */
#notification-wrapper {
  position: relative;
}

#notification-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  background-color: #ff4d4d;
  border-radius: 50%;
  border: 1.5px solid white;
}

/* お知らせの枠（スマホでは幅を調整） */
#notification-dropdown {
  position: absolute;
  left: 0;
  top: 50px;
  width: 280px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  color: #333;
  text-align: left;
}

#notification-dropdown.hidden {
  display: none;
}

/* 横幅が非常に狭いスマホ（iPhone SEなど）への最終調整 */
@media (max-width: 350px) {
  .site-title {
    font-size: 0.8rem;
    letter-spacing: -1px;
  }
  .header-left,
  .header-right {
    flex-basis: 35px;
  }
}
