/* リセットと基本設定 */
body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    /* 背景色: 斜めの水色・白・薄いオレンジのグラデーション */
    background: linear-gradient(to bottom right, #9FD0F3 0%, #fff 50%, #F7BA99 100%);
    min-height: 100vh;
}

.modal-open-body {
  overflow: hidden;

  -webkit-user-select: none; /* Safari, Chrome */
  -ms-user-select: none;     /* IE 10+ */
  user-select: none;         /* 標準 */
}

.container {
    padding: 0 15px; /* 左右の余白 */
    margin: 0 auto;
}

.header {
  position: relative;
  width: 100%;
  height: auto;
  display: block;
  z-index: 1;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
}

.ro-kun-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fff; /* 仮の画像プレースホルダー */
    color: #ff0033;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    margin: 0 10px;
}

.title {
    color: white;
    font-size: 1.2em;
    line-height: 1.3;
    margin: 0;
    font-weight: 900;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3); /* 文字に影をつけて見やすく */
    padding: 10px 0;
}

.nickname-section {
  position: absolute;
  text-align: center;
  bottom: 19vw;
  width: 100vw;
  
  z-index: 5;
  padding: 0;
}

.input-group {
  display: flex;         /* 横並びにするためのFlexboxを有効化 */
  align-items: center;   /* 高さが違う場合でも上下中央に揃える */
  margin-top: 15px;      /* タイトルとの間に少し余白を追加 */
}

.input-group input {
  flex-grow: 1; /* ← これが重要 */
}

.input-group button {
  margin-left: 10px;
}

.nickname-input {
    padding: 1vw 1vw;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    width: 40vw;
    margin-right: 5px;
    cursor: pointer; /* モーダルを起動するためにポインターカーソルに */
}

.nickname-text {
  position: relative;
  background-color: white;
  border-radius: 30px; /* 角の丸み */
  padding: 0.5vw 2vw;
  display: inline-flex;  /* 中の要素を横並びにする */
  align-items: center;   /* 上下中央揃え */
  border: 1px solid #ddd; /* 薄い枠線（任意） */
  font-weight: bold;
  z-index: 10;
}
/* 表示されるニックネームテキスト（赤文字）のスタイル */
.nickname-text-display {
  color: red;
  font-size: 0.8em;
  font-weight: bold;
  z-index: 20;
}

.nickname-text-suffix {
  color: #1456A6;
  font-size: 0.8em;
  font-weight: bold;
  z-index: 20;
}


/* 要素を非表示にするための汎用クラス */
.hidden {
  display: none !important;
}

.selector-text {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

/* ネクスト推し商品タイトル */
.next-oshi-title {
    text-align: center;
    color: #007bff; /* 青色 */
    font-size: 1.6em;
    margin-top: 20px;
    font-weight: 800;
}

/* 説明文の青いバー */
.info-bar {
    background-color: #1456A6; /* 濃い青 */
    color: white;
    padding: 15px;
    margin: 20px 0;
    border-radius: 15px;
    text-align: center;
}

.info-bar p {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.4;
}

.highlight {
    font-weight: bold;
    font-size: 1.1em;
}

/* 商品登録カードグリッド */
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2列 */
    column-gap: 15px; /* 列間のスペース (横) は維持 */
    row-gap: 5px; /* 行間のスペース (縦) を5pxに縮小 */
    padding: 10px 0;
}

/* カードと情報エリアのラッパー */
.card-wrapper {
    display: flex;
    flex-direction: column;
}

.product-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: white;
    padding: 10px;
    text-align: center;
    aspect-ratio: 1 / 1; /* 正方形を維持 */
    height: auto;
    border: 1px solid #ddd;
    overflow: hidden; /* 縦長画像を切り取るために必須 */
    position: relative; /* update-icon の基準点 */
}

/* 登録済み画像スタイル */
.product-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 横幅を基準に拡大し、上下を切り取る */
    display: block;
}

/* 回転ボタン（更新アイコン）のスタイル */
.update-icon-img {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
    z-index: 10;
}

/* 商品情報エリア (カードの下) */
.product-info {
    text-align: left;
    padding: 5px 0 15px;
}

.product-card-title {
    font-size: 1em;
    font-weight: bold;
    color: #333;
    margin: 0 0 5px;
}

.product-card-description {
    font-size: 0.8em;
    color: #666;
    margin: 0 0 5px;
    line-height: 1.3;
}

.product-card-number {
    font-size: 0.75em;
    color: #999;
    margin-bottom: 5px;
}

.product-card-category {
    display: inline-block;
    background-color: #007bff; /* 青色の背景 */
    color: white;
    font-size: 0.7em;
    padding: 3px 6px;
    border-radius: 3px;
    font-weight: normal;
    margin-left: 5px;
}

.footer {
    width: 100%;
    display: block;
    text-align: center;
}

.header-image,
.footer-image {
  width: 100%;
  height: auto;
  display: block;
  z-index: 1; 
}

.footer-image-container {
  position: relative;
  width: 100%;
  margin-top: -50px;
}

.footer-raised {
  margin-top: -100px; /* ← キャプチャ時の値を設定 */
}

/* 2. コピーライト表記(<small>)を画像の中央に配置 */
.footer-image-container small {
  position: absolute;               /* 親要素を基準に絶対配置 */
  top: 70%;                         /* 親要素の上から50%の位置に */
  left: 50%;                        /* 親要素の左から50%の位置に */
  transform: translate(-50%, -50%); /* 要素自身の大きさの半分だけ移動して中央揃え */

  /* 以下は見た目を調整するための推奨スタイル */
  color: black;                     /* 文字色を黒に */
  font-size: 0.6em;                 /* フォントサイズを少し小さく */
  text-align: center;               /* テキストを中央揃えに */
  width: 100%;                      /* 横幅いっぱいに広げてセンタリングを安定させる */
}

/* --- モーダル共通スタイル --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.hidden {
    display: none;
}

.modal-content {
    position: absolute; /* または fixed */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    background-color: white;
    border-radius: 15px;
    padding: 40px 40px;
    width: 70vw;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease-out;
}

.modal-title {
    color: #1e62a0;
    font-size: 1.2em;
    margin: 10px 0 25px !important;
    font-weight: bold;
}

.product-number-input, .nickname-modal-input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1.2em;
    width: 80%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.product-number-input:focus, .nickname-modal-input:focus {
    border-color: #007bff;
}

.submit-button {
    padding: 10px 15px;
    background-color: #1456A6;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.0em;
    font-weight: bold;
    width: 30%;
}

.submit-button:hover {
    background-color: #cc002a;
}

.submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* --- 追記・変更分 --- */

#generate-image-button {
    background-color: #ff0033;
    margin: 10px 0;
    padding: 12px 12px;
    border-radius: 50px;
    width: 65vw;
}

#generate-image-button:disabled {
  background-color: #d9d9d9; /* 背景をグレーに */
}

.debug-button {
    background-color: #6c757d;
    font-size: 0.8em;
    padding: 8px 20px;
}
.debug-button:hover {
    background-color: #5a6268;
}

/* 結果表示モーダル */
.result-modal-content {
    background-color: white;
    border-radius: 15px;
    padding: 20px;
    width: 90%;
    max-width: 500px; /* 横幅を少し広げる */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-sizing: border-box; 
}

.modal-description {
    font-size: 0.9em;
    color: #555;
    margin-top: -15px;
    margin-bottom: 15px;
    flex-shrink: 0; /* この要素は縮まないようにする */
}

#result-image-wrapper {
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 20px;
    background-color: #f9f9f9;

    /* 親要素(モーダル)の余った高さをすべて使い、必要なら縮む */
    flex: 1;
    min-height: 0; /* flexアイテムが正しく縮小するために必要 */
    overflow: hidden; /* 念のため、はみ出しを隠す */
}

#captured-image {
    display: block;
    margin: 0 auto; /* 横方向の中央寄せ */
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.captured-image-close-button {
    text-align: center;
  background: none;      /* 背景をなくす */
  border: none;          /* 枠線をなくす */
  padding: 0;            /* 内側の余白をなくす */
  box-shadow: none;      /* 影をなくす */
    font-size: 1.2em;      /* フォントサイズを大きく */
}

#close-result-modal {
    flex-shrink: 0; /* 画像が大きくてもボタンが縮まないようにする */
}

#close-result-modal:hover {
    background-color: #0056b3;
}

.product-image-container {
  flex-grow: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.heart-placeholder-image {
  width: auto;
  height: 30vw;
  display: block;
}

.product-register-text {
  width: 100%;
  text-align: center;
  margin: 5px ;
}

.hide-for-capture {
  display: none !important;
}

#capture-area {
  position: relative;
}

#capture-base-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: auto;
}

.capture-nickname-section {
  position: absolute;
  text-align: center;
  top: 10vw;
  width: 100vw;
  
  z-index: 5;
  padding: 0;
}

.capture-products-section {
  position: absolute;
  width: 100vw;
  height: auto;
  top: 30vw;
  display: block;
  z-index: 5;
}

.capture-product-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 40vw;
  height: 38vw;
}

.capture-product-item1 {
  top: 10vw;
  left: 5vw;
}
.capture-product-item2 {
  top: 30vw;
  left: 55vw;
}
.capture-product-item3 {
  top: 59vw;
  left: 5vw;
}
.capture-product-item4 {
  top: 80vw;
  left: 55vw;
}


.capture-product-image-box {
    display: flex;
    width: 23vw;
    height: 22vw;
    align-items: center;
    text-align: center;
    aspect-ratio: 1 / 1;
    overflow: hidden; /* 縦長画像を切り取るために必須 */
    position: relative;
}
.capture-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 横幅を基準に拡大し、上下を切り取る */
    display: block;
}

.capture-card-title {
    font-size: 0.5rem;
    font-weight: bold;
    margin: 0;
    color: #007bff;
}

.capture-card-category {
    position: absolute;
    display: inline-block;
    background-color: #007bff; /* 青色の背景 */
    color: white;
    font-size: 0.5rem;
    padding: 0.5vw 2vw;
    border-radius: 15px;
    bottom: 1vw;
}