* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #120e1c;
  color: #f6ecd2;
  font-family: "Kaisei Decol", "Yu Mincho", "Hiragino Mincho ProN", serif;
}

/* 上下に2つ並べる */
.portal {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
  min-height: 100svh;
  padding: 12px;
}

/* 1つ分の入口（全体がリンク）。狭い画面では絵の下に文字 */
.gate {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 16px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background-color: #2a2140;
  border: 2px solid #c9a85a;
  outline: 1px solid rgba(201, 168, 90, 0.55);
  outline-offset: -8px;
}

.gate-room {
  --bg: url("img/bg-shimemaru.jpg");
}

.gate-kingdom {
  --bg: url("img/bg-lospote.jpg");
}

/* 後ろの景色（AI作成の背景）を暗くして敷く */
.gate::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg) center / cover no-repeat;
  filter: brightness(0.4);
  transition: filter 0.3s;
}

/* 押せることが分かるように、乗せると明るくなる */
.gate:hover::before,
.gate:focus-visible::before {
  filter: brightness(0.6);
}

.gate:focus-visible {
  outline: 3px solid #f3d98b;
}

/* 絵（金の額縁） */
.gate-pic {
  position: relative;
  flex: none;
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: max(170px, calc(50svh - 150px));
  border: 2px solid #c9a85a;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
  transition: transform 0.3s;
}

.gate:hover .gate-pic,
.gate:focus-visible .gate-pic {
  transform: scale(1.03);
}

.gate-inner {
  position: relative;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.gate-title {
  display: block;
  font-size: clamp(1.5rem, 5.5vw, 3rem);
  letter-spacing: 0.06em;
  color: #f3d98b;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85), 0 0 18px rgba(243, 217, 139, 0.35);
}

/* タイトル下の飾り線 */
.gate-title::after {
  content: "";
  display: block;
  width: 70%;
  height: 1px;
  margin: 0.35em auto 0;
  background: linear-gradient(90deg, transparent, #c9a85a, transparent);
}

.gate-text {
  display: block;
  margin-top: 0.7em;
  font-size: clamp(0.9rem, 2.2vw, 1.15rem);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* 横長の画面では絵と文字を横に並べる（ろすぽては左右反対） */
@media (min-width: 700px) and (min-aspect-ratio: 5/4) {
  .gate {
    flex-direction: row;
    gap: 5%;
    padding: 20px 5%;
  }

  .gate-kingdom {
    flex-direction: row-reverse;
  }

  .gate-pic {
    max-width: 55%;
    max-height: max(200px, calc(50svh - 64px));
  }

  .gate-title {
    font-size: clamp(1.6rem, 3.4vw, 3rem);
  }
}
