:root {
  --purple: #3c3c6c;
  --light: #e2e2f4;
  --cyan: #efefef;
  --white: #ffffff;
  --input-bg: #ffffff;
  --input-border: #cccccc;
  --input-focus-border: #3c3c6c;
  --btn-bg: #3c3c6c;
  --btn-hover-bg: #5c5c8c;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: visible;
  font-family: sans-serif;
  background-color: var(--cyan);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ヘッダー */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  background: var(--purple);
  padding: 10px 20px;
  color: var(--white);
  overflow-x: auto;
  gap: 8px;
}

.logo {
  font-size: 2rem;
  flex: 0 0 auto;
  line-height: 1;
  display: flex;
  align-items: center;
  height: 100%;
}

.nav {
  display: flex;
  padding: 0px;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a {
  margin: 0 5px;
  padding: 5px 10px;
  border-radius: 10px;
  background: var(--purple);
  color: #fff;
  font-size: 1.2rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav a:hover {
  background: #5c5c8c;
}

.settings-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  margin-left: auto;
}

/* サイドバー */
.sidebar {
  position: fixed;
  top: 55px;
  left: 0;
  width: clamp(200px, 20%, 280px);
  height: calc(100vh - 55px);
  background: #4c4c7c;
  padding: 10px 5px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition:
    left 0.3s ease,
    width 0.3s ease;
  font-family: sans-serif;
}

.sidebar.hidden {
  left: -300px;
}

.sidebar__title {
  color: white;
  font-size: 1.3rem;
  margin-bottom: 5px;
  padding-left: 10px; /* ← 左に余白をつける */
}

.sidebar__menu {
  list-style: none;
  padding: 0;
  margin: 5px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar__menu li {
  margin: 0;
  padding: 0;
  background-color: transparent;
}

.sidebar__menu li a {
  display: block;
  width: 100%;
  padding: 8px 6px;
  border-radius: 8px;
  color: var(--white);
  text-decoration: none;
  background: #5c5c8c;
  transition: background 0.3s;
  font-size: 1rem;
  word-break: break-word;
  white-space: normal;
  text-align: left;
}

.sidebar__menu li a:hover {
  background: #3c3c6c;
}

/* トップへ戻る */
#to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 45px;
  height: 45px;
  background: var(--purple);
  color: var(--white);
  border: none;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#to-top:hover {
  background: var(--btn-hover-bg);
}

/* フッター */
footer {
  background: var(--purple);
  color: var(--white);
  text-align: center;
  padding: 10px 0;
  margin-top: 40px;
}

@media (max-width: 800px) {
  .header {
    padding: 8px 8px;
    gap: 3px;
    height: 60px;
  }
  .nav {
    gap: 3px 0px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .nav a {
    font-size: 1.2rem;
    margin: 0 4px;
    padding: 6px 3px;
    white-space: nowrap !important;
  }
  .menu-toggle {
    font-size: 1.2rem;
    padding: 6px 8px;
  }
  .sidebar {
    transform: translateX(-100%);
    width: 60%;
    max-width: 250px;
    padding: 5px 0px;
  }
  .sidebar__title {
    padding-left: 10px; /* ← 左に余白をつける */
  }
  .sidebar.visible {
    transform: translateX(0);
  }
  .sidebar__menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .sidebar__menu li {
    margin-bottom: 5px;
  }
  .sidebar__menu li a {
    font-size: 1rem;
    padding: 4px 6px;
    text-align: left;
    word-break: break-word;
    white-space: normal;
  }
}

@media (max-width: 600px) {
  .nav a {
    font-size: 0.9rem !important;
    margin: 2px 4px;
    padding: 2px 10px;
    white-space: nowrap !important;
    margin: 10px 5px;
  }
  .header {
    height: 60px; /* 同じ高さを維持 */
  }
}

@media (max-width: 800px) and (min-width: 601px) {
  .header {
    height: 60px;
  }
}

@media (max-width: 1300px) and (min-width: 1200px) {
  .header {
    height: 60px;
  }
}

@media (max-width: 1000px) and (min-width: 801px) {
  .header {
    height: 60px;
  }
}

/* ポップアップ全体のスタイル */
#terms-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* ポップアップボックスのスタイル */
.popup-content {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 650px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.popup-content h2 {
  margin-top: 0;
}

.popup-content p {
  margin: 20px 0;
  font-size: 16px;
}

.popup-content button {
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.popup-content button.accept {
  background-color: #3c3c6c;
  color: white;
  transition: color 0.15s ease-in-out;
}

.popup-content button.accept:hover {
  color: #ddd;
}

/* --- ハンバーガーメニュー --- */
.menu {
  position: relative;
  width: 30px;
  height: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 200;
}
.menu span {
  display: block;
  position: absolute;
  width: 20px;
  height: 2px;
  background-color: white;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}
.menu span:nth-of-type(1) {
  transform: translateY(-6px);
}
.menu span:nth-of-type(2) {
  transform: translateY(0);
}
.menu span:nth-of-type(3) {
  transform: translateY(6px);
}

#menu:checked ~ .menu span:nth-of-type(1) {
  transform: rotate(45deg);
}
#menu:checked ~ .menu span:nth-of-type(2) {
  opacity: 0;
}
#menu:checked ~ .menu span:nth-of-type(3) {
  transform: rotate(-45deg);
}

#menu {
  display: none;
}
