:root {
  --button-color: #fd3e66;
  --button-color-hover: #c51616;
  --form-border-color: #ccc;
  --form-bg-color: #fafafa;
  --bg-color: #f0f2f5;
  --box-bg-color: #fff;
  --black: #222;
}

/* === 全体のレイアウト === */
body {
  background-color: var(--bg-color);
}

/* === モーダル === */
.form-container {
  background-color: var(--box-bg-color);
  padding: 2rem 2.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  width: 100%;
}

.modalsize {
  margin: 100px auto;
  max-width: 400px;
}

.detailsize {
  margin: 100px auto;
  max-width: 800px;
}

.form-container .logo{
  width: 70px;
  height: auto;
  margin: 0 auto 10px;
}

.form-container h1 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.form-container label {
  display: block;
  margin-top: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.form-container input[type="email"],
.form-container input[type="password"],
.form-container input[type="text"] {
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.1rem;
  border: 1px solid var(--form-border-color);
  border-radius: 6px;
  font-size: 1rem;
  background-color: var(--form-bg-color);
}

.form-container button {
  margin-top: 1.5rem;
  padding: 0.6rem 1.2rem;
  width: 100%;
  background-color: var(--button-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

.form-container button:hover {
  background-color: var(--button-color-hover);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
  background-color: var(--form-bg-color);
  padding: 20px 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.modal .close {
  position: absolute;
  right: 1em;
  top: 0.5em;
  font-size: 1.5em;
  font-weight: 600;
  cursor: pointer;
}

.modal-buttons {
  margin-top: 1em;
  display: flex;
/*  flex-direction: column; */
  gap: 1em;
}

.modal-btn {
  display: block;
  background: var(--button-color);
  color: white;
  padding: 0.8em;
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
  transition: background 0.3s;
}

.modal-btn:hover {
  background: var(--button-color-hover);
}

@media screen and (max-width: 600px) {
  .form-container {
    padding: 2rem 1.5rem;
  }
  .modalsize,
  .detailsize,
  .modal-content {
    margin: 20px auto;
    max-width: calc(100% - 40px);
  }
}

/* === 一覧 === */
#gallery {
  padding: 50px;
}

#gallery .form-container {
  margin-bottom: 2rem;
}

#gallery .gallery-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}

#gallery .gallery-header .left {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
}

#gallery .gallery-header .logo-area {
  height: 100%;
  border-right: 1px solid var(--black);
  padding-right: 50px;
  margin-right: 50px;
}
#gallery .gallery-header .logo-area span {
  display: block;
  margin: 5px auto 0;
  text-align: center;
}

#gallery .gallery-header .logo {
  width: 200px;
  height: auto;
  margin: 0;
}

#gallery .form-container button {
  margin-top: 0;
}

#gallery .form-container button+button,
#gallery .form-container .right form+form {
  margin-top: 10px;
}
#gallery .form-container .right form button {
  font-size: 0.8rem;
}

#gallery .book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}

#gallery .book-grid a {
  display: block;
  text-align: center;
  transition: transform 0.2s;
}

#gallery .book-grid img {
  width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
#gallery .book-grid .fallback {
  width: 100%;
  height: 180px;
  padding: 0.4rem 0.2rem;
  border: 1px solid var(--form-border-color);
  background-color: var(--form-bg-color);
  border-radius: 8px;
  font-size: 0.8rem;
}

#gallery .book-grid a:hover {
  transform: scale(1.03);
}

#gallery .pagination {
  margin-top: 2rem;
  text-align: center;
}
#gallery .pagination a {
  display: box;
  padding: 0.5rem 1rem;
  background: var(--button-color);
  border-radius: 6px;
  color: #fff;
}
#gallery .pagination a+a {
  margin-left: 10px;
}

#gallery .pagination a:hover {
  background: var(--button-color-hover);
}

#gallery .search-form {
  width: 400px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-left: 20px;
}
#gallery .search-form input {
  width: 70%;
}
#gallery .search-form button {
  width: calc(30% - 10px);
  margin-left: 10px;
}

@media (max-width: 600px) {
  #gallery {
    width: calc(100% - 40px);
    padding: 0;
    margin: 0 auto;
  }
  #gallery .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
  #gallery .gallery-header {
    display: block;
  }
  #gallery .gallery-header .logo-area {
    width: 100%;
    height: 100%;
    border-right: none;
    padding-right: 0;
    margin-bottom: 10px;
    margin-right: 0;
  }
  #gallery .gallery-header .logo {
    width: 120px;
    height: auto;
    margin: 0 auto;
  }
  #gallery .form-container .buttonArea {
    width: 100%;
    margin-bottom: 10px;
  }
  #gallery .form-container button {
    width: 100%;
    margin-top: 0;
  }

  #gallery .form-container button+button,
  #gallery .form-container .right form+form {
    margin-top: 10px;
  }
  #gallery .search-form {
    margin-left: 0;
  }
  #gallery .search-form button {
    width: calc(30% - 10px);
  }
  #gallery .form-container .right {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
  }
  #gallery .form-container .right form {
    width: calc(50% - 5px);
    margin-top: 10px;
  }
}

/* === 詳細 === */

#detail .book-detail {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  margin-bottom: 20px;
}

#detail .book-detail img {
  width: 150px;
  height: auto;
  margin-right: 60px;
  border: 1px solid var(--form-border-color);
  border-radius: 8px;
}

#detail .book-detail .book-info div {
  border-bottom: 1px dotted var(--form-border-color);
}

#detail .book-detail .book-info .label {
  display: inline-block;
  width: 120px;
  padding: 0.1rem 1rem 0.1rem 0;
  font-weight: 600;
  text-align: right;
}

@media (max-width: 600px) {
  #detail .book-detail {
    display: block;
  }
  #detail .book-detail img {
    margin: 0 auto 20px;
  }
  #detail .book-detail .book-info div {
    margin-bottom: 15px;
  }
  #detail .book-detail .book-info .label {
    display: block;
    text-align: left;
  }
}

/* === カメラ === */

#reader {
  width: 100%;
  margin: 10px 0;
}