html {
  overflow-x: hidden;
}

body {
  font-family: "Kiwi Maru", serif;
  background-color: #FEEA92;
  overflow-x: hidden;
  margin: 0;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px;
}

h1 {
  font-family: "Fredoka";
  font-size: 40px;
  font-weight: normal;
  color: #000000;
  margin: 0;
  position: relative;
  display: inline-block;
  padding-bottom: 20px;
}

.line1 {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  margin: 0;
}

.bazaar-attention {
  font-size: 18px;
}

.bazaar-king {
    display: grid;
    grid-template-columns: 90px 1fr;
    column-gap: 25px;
    align-items: center;

    max-width: 600px;
    padding: 15px;
    margin-bottom: 30px;

    background-color: #F28C38;
    border-top: #D9600F solid 10px;
    border-bottom: #D9600F solid 10px;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .bazaar-king {
        width: 100vw;
        max-width: none;
        flex-shrink: 0;
    }
}

.bazaar-king > img {
    width: 90px;
    height: auto;

    object-fit: contain;

    flex-shrink: 0;
}

.bazaar-king-text {
    display: contents;
    color: #FFFFFF;
    text-align: center;
}

.bazaar-king-title {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
}

.bazaar-king > img {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
}

.bazaar-king-desc {
    grid-column: 2;
    grid-row: 2;
}

.bazaar-king-action {
    grid-column: 1 / -1;
    grid-row: 3;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 15px;
}

.bazaar-king-action .bazaar-king-button {
    grid-column: 2;
}

.bazaar-king-action .bazaar-king-qr {
    grid-column: 3;
    justify-self: start;
}

.bazaar-king-title {
    font-size: 1.5em;
    margin: 0 0 10px;  
}

.bazaar-king-desc {
    margin: 0 0 15px;
}

.bazaar-king-button {
    display: inline-block;

    padding: 8px 25px;

    border: none;
    border-radius: 30px;

    background-color: #F28C38;
     border: #FFFFFF solid 3px;
    color: #FFFFFF;

    font-family: "Kiwi Maru", serif;
    font-size: 1em;

    text-decoration: none;

    cursor: pointer;
}



.bazaar-king-qr {
    width: 70px;
    height: 70px;

    object-fit: contain;
}

.bazaar-row {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2%;
  gap: 30px;
}

.tab-img {
  width: 158px;
}

.bazaar-button {
  position: relative;

  border: none;
  background-color: #F9AD22;
  border-radius: 50%;

  width: 140px;
  height: 140px;
  margin: 0 1%;
  padding: 3%;

  cursor: pointer;

  box-shadow: 5px 5px 0 #D6840C;

  /* アニメーション */
  transition: background-color 0.3s;

  display: flex;
  align-items: center;
  justify-content: center;
}


/* 選択中 */
.bazaar-button.active {
  background-color: #F97F22;
}


.bazaar-button .date-star {
  display: none;
  position: absolute;
  width: 50px;
  height: 50px;
  top: -12px;
  right: -6px;
  z-index: 2;
}

.bazaar-button.active .date-star {
  display: block;
  animation: purun 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ぷるんっアニメーション定義（タイムテーブル(イベント/音楽)と共通） */
@keyframes purun {
  0% {
    transform: scale(0) rotate(-20deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.05) rotate(10deg); /* 一度ぐっと大きく */
    opacity: 1;
  }
  75% {
    transform: scale(0.9) rotate(-5deg); /* 反動で少し縮む */
  }
  100% {
    transform: scale(1) rotate(0deg); /* 元のサイズに着地 */
    opacity: 1;
  }
}


/* =========================
   バザー一覧
   ========================= */

.bazaar-content {
  display: none;
  flex-direction: column;
  width: min(440px, 100vw - 40px);
}

.bazaar-content.active {
  display: flex;
}


.bazaar-item {
  position: relative;
  z-index: 0;
  border: 2px solid transparent;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 60px;

  cursor: pointer;
}

.bazaar-item .planet-decoration {
  position: absolute;
  width: 300px;
  height: auto;
  z-index: -1;
  top: 580px;
  transform: translateY(-50%);
  opacity: 0.8;
  pointer-events: none;
  display: none;
}

.bazaar-item:nth-child(4n+1) .planet-decoration {
  display: block;
  left: -160px;
}

.bazaar-item:nth-child(4n+3) .planet-decoration {
  display: block;
  right: -160px;
}

.bazaar-item:last-child .planet-decoration {
  display: none;
}

/* 画像の枠：展示の .image-box と同じ */
.frame {
  position: relative;
  width: 280px;
  height: 340px;
  margin-bottom: 10px;
  background-color: #FFF2B9;
  border: 3px solid #F9AD22;
  border-radius: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 5px 5px 0 #F9AD22;
}

.bazaar-item:has(.label-box-1) .frame {
  border-color: #DA9923;
  box-shadow: 5px 5px 0 #DA9923;
}

.frame-img {
  display: none;
}

.item-img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  object-position: center;
}

.label-box {
  background-color: #FFF2B9;
  border: #F9AD22 solid 3px;
  border-radius: 15px;

  color: #000;

  width: 260px;
  padding: 10px;
  margin-top: 15px;

  display: flex;
  flex-direction: column;

  justify-content: center;
  align-items: center;

  text-align: center;

  box-sizing: content-box;
}

.label-box p {
  margin: 2px 0;
}

.bazaar-subtitle {
  border-bottom: #F9AD22 solid 3px;
  font-size: 1.3em;
}

.label-box-1 {
  background-color: #FFF2B9;
  border: #DA9923 solid 3px;
  border-radius: 15px;

  color: #000;

  width: 260px;
  padding: 10px;
  margin-top: 15px;

  display: flex;
  flex-direction: column;

  justify-content: center;
  align-items: center;

  text-align: center;

  box-sizing: content-box;
}

.label-box-1 p {
  margin: 2px 0;
}

.bazaar-subtitle-1 {
  border-bottom: #DA9923 solid 3px;
  font-size: 1.3em;
}

/* =========================
   ポップアップ
   ========================= */

.popup-overlay {
  position: fixed;

  top: 0;
  left: 0;

  width: 100%;
  height: 100%;

  display: flex; 

  align-items: center;
  justify-content: center;

  background: rgba(120, 115, 80, 0.9);

  z-index: 100;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.popup-content {
  position: relative;
  text-align: center;
}

.popup-box {
  background-color: #FEEA92;
  border: #333 solid 2px;
  border-radius: 20px;

  display: inline-block;

  width: 330px;
  max-height: 75vh;

  position: relative;

  padding: 60px 25px 25px 25px;

  box-sizing: border-box;

  overflow: hidden;
  overflow-y: auto;

  /* 下から上へフェードイン／アウト */
  transform: translateY(28px);
  transition: transform 0.3s ease;
}

.popup-overlay.active .popup-box {
  transform: translateY(0);
}


/* ポップアップ画像 */

.popup-frame {
  position: relative;

  width: 300px;
  height: 300px;

  margin: 15px 0px 15px -10px;
}

.popup-frame-img {
  width: 100%;
  height: 100%;

  object-fit: contain;
}

.popup-img {
  position: absolute;

  top: 10%;
  left: 4%;

  width: 90%;
  height: auto;

  max-height: 77%;

  object-fit: contain;
}


/* ポップアップの商品情報 */

.popup-text-box {
  background-color: #FFF2B9;
  border: #D6840C solid 2px;
  border-radius: 10px;

  color: #000;

  padding: 15px;

  margin-top: 20px;

  text-align: center;

  max-height: 1000px;

  font-size: clamp(0.8em, 2vw, 1em);

  box-sizing: border-box;
}

.popup-text-box p {
  margin: 5px 0;
}

.popup-desc {
  font-size: 1em;
  margin: 0.5em 0;
}


/* =========================
   ×ボタン
   ========================= */

.close-btn {
  position: absolute;

  top: 15px;
  right: 15px;

  width: 40px;
  height: 40px;

  cursor: pointer;

  z-index: 10;

  display: flex;

  align-items: center;
  justify-content: center;
}

.close-btn img {
  width: 100%;
  height: 100%;

  object-fit: contain;

  pointer-events: none;
}