/* メインのコンテナ（変更なし・確認用） */
#main {
  
  margin-top: 70px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-template-rows:1fr 1fr;
  gap: 10px;
  padding:10px;
  justify-content:center;
  align-items:center;
}

/* カード全体 */
.id-card {
  position: relative;
  width: 400px;
  height: 250px;
  /* aspect-ratio は削除（height固定があるため不要。コンフリクト防止） */
  
  border-radius: 18px;
  overflow: hidden; /* はみ出し防止の命綱 */
  border: 1px solid rgba(0,0,0,.12);
  background:
    radial-gradient(1200px 400px at 20% 20%, rgba(120,180,255,.22), transparent 60%),
    radial-gradient(900px 350px at 80% 30%, rgba(255,140,200,.18), transparent 55%),
    linear-gradient(180deg, #fafbff, #f3f6ff);
  box-shadow: 0 18px 40px rgba(0,0,0,.12);
  
  /* --- Grid設定の核心 --- */
  display: grid;
  grid-template-columns: 1fr 1fr; /* 左右2分割 */
  gap: 10px;
  padding: 22px; /* 上下左右の内側余白 */
  
  /* アイテムを強制的に上下中央配置 */
  align-items: center; 
  /* アイテムを強制的に左右中央配置（念の為） */
  justify-items: center; 
  border: solid 2px purple;
  grid-template-rows: 1fr;   /* 行を確定させる（重要） */
  align-content: center;     /* ★グリッド全体を上下中央へ */
}

/* 赤枠：写真エリア（ここを大幅修正） */
.id-card__photo {
  /* 不要なサイズ固定を解除し、限界値(max)で制御する */
  width: auto;
  height: auto;
  
  /* 親枠(Gridセル)からはみ出さないための絶対防壁 */
  max-width: 100%;
  max-height: 100%;
  /* これで「収まる範囲で最大の正方形」になる */
  aspect-ratio: 1 / 1;
  
  /* Gridセル内での配置 */
  justify-self: center; /* 左右中央 */
  align-self: center;   /* 上下中央 */
  
  border-radius: 14px;
  background: rgba(255,255,255,.6);
  padding: 10px;
  
  /* 中のimg配置用 */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 画像本体 */
.id-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* 枠内で比率維持 */
  border-radius: 10px;
  display: block;      /* 隙間防止のおまじない */
}

/* 紫枠：情報エリア（ここも修正） */
.id-card__info {
  position: relative;
  z-index: 1;
  width: 100%;       /* 横幅はエリア一杯に */
  height: 100%;      /* 高さは親に合わせる */
  max-height: 100%;  /* はみ出し防止 */
  
  display: grid;
  grid-template-rows:1fr;

  
 
  
  /* ★重要：ここに aspect-ratio は絶対に書かないこと */
  
  /* 左寄せに戻す（親でjustify-items: centerしているため、ここはstartにする） */
  justify-self: stretch; 
  text-align: left;
}

/* --- 以下、変更なし --- */
.id-card__watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 800 64px/1 system-ui, sans-serif;
  letter-spacing: .18em;
  color: rgba(0,0,0,.08);
  transform: rotate(-18deg);
  pointer-events: none;
  user-select: none;
}

.row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: baseline;
}

.label {
  font-size: 12px;
  color: rgba(0,0,0,.65);
  letter-spacing: .06em;
  border: solid 2px blue;
  width: 30px;
}

.value {
  font-size: 16px;
  color: rgba(0,0,0,.88);
  font-weight: 650;
  border-bottom: 1px dashed rgba(0,0,0,.18);
  padding-bottom: 6px;
  border: solid 2px yellow;
}

.note {
  font-size: 12px;
  color: rgba(0,0,0,.65);
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 12px;
  padding: 10px;
  /* heightは成り行きに任せるか、必要なら%指定 */
  height: 100%; 
  border:1px black solid;
}

#flexbox {
  display: flex;
}

/* レスポンシブ */
@media (max-width: 727px) {
  #main {
  border: solid 3px yellow;
  margin-top: 70px;
  display: flex;
  flex-direction:column;
  
  gap: 10px;
}
  
}

@media (min-width:728px) and (max-width:1028px){
  #main {
  border: solid 3px green;
  margin-top: 70px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows:1fr 1fr;
  gap: 10px;
}
}