:root {
  --header-height: 88px;
  --gap: 24px;
  --button-size: min(34vw, 220px);
  --radius: 18px;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
}

main {
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, var(--button-size));
  gap: var(--gap);
  justify-content: center;
  align-items: center;
}

.image-button {
  width: var(--button-size);
  aspect-ratio: 1 / 1;
  position: relative;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  background: #d1d5db;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  text-decoration: none;
}

.image-button:hover,
.image-button:focus-visible {
  transform: translateY(-4px);
  filter: brightness(1.04);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.2);
  outline: none;
}

.image-button:focus-visible {
  outline: 4px solid rgba(59, 130, 246, 0.55);
  outline-offset: 4px;
}

.image-button img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.image-button span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  background: rgba(0, 0, 0, 0.62);
}

/* スマホ縦持ち：4つのボタンを縦1列にする */
@media (max-width: 767px) and (orientation: portrait) {
  :root {
    --button-size: min(76vw, 260px);
    --gap: 18px;
    --header-height: 124px;
  }

  .button-grid {
    grid-template-columns: 1fr;
  }

  .image-button {
    width: var(--button-size);
  }
}

/* スマホ横持ち：4つのボタンを横1列にする */
@media (max-width: 950px) and (max-height: 520px) and (orientation: landscape) {
  :root {
    --button-size: min(21vw, calc((100vh - var(--header-height) - var(--footer-height) - 56px)));
    --gap: 14px;
    --header-height: 64px;
  }

  main {
    padding: 18px 16px;
  }

  .button-grid {
    grid-template-columns: repeat(4, var(--button-size));
  }

  .image-button span {
    min-height: 44px;
    font-size: 0.9rem;
  }
}
