* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: #03040c;
  color: #f5ead0;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
}

body {
  overflow-x: hidden;
}

button {
  font: inherit;
}

.app {
  width: 100%;
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: center;
  background:
    radial-gradient(circle at center, rgba(32, 50, 110, 0.35), transparent 55%),
    linear-gradient(180deg, #02030a, #070b18);
  overflow-x: hidden;
}

.screen {
  width: min(100vw, 1080px);
  min-height: 100svh;
  position: relative;
  overflow: hidden;
}

.hidden {
  display: none;
}

/* =========================
   タイトル画面
========================= */

.title-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #03040c;
}

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

.hotspot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 48%;
  height: 7%;
  border: none;
  background: rgba(255, 255, 255, 0);
  color: transparent;
  cursor: pointer;
  z-index: 10;
}

.hotspot-one {
  top: 56.5%;
}

.hotspot-three {
  top: 67.5%;
}

.ai-usage-note {
  position: absolute;
  right: 14px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 12;
  max-width: min(58vw, 420px);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  color: rgba(255, 255, 255, 0.78);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: clamp(9px, 1.4vw, 12px);
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-align: right;
  pointer-events: none;
}

body.is-transitioning::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(255, 245, 190, 0.9), transparent 45%),
    rgba(255, 255, 255, 0.18);
  animation: screenFlash 2.5s ease forwards;
  z-index: 9999;
}

@keyframes screenFlash {
  0% {
    opacity: 0;
  }

  35% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

/* =========================
   1枚占いページ
========================= */

.draw-screen,
.result-screen {
  padding: 32px 20px;
  text-align: center;
  background:
    radial-gradient(circle at center top, rgba(38, 62, 135, 0.4), transparent 50%),
    linear-gradient(180deg, #050713, #02030a);
}

.one-page-header {
  margin: 32px auto 24px;
  text-align: center;
}

.small-title {
  margin: 0 0 8px;
  color: #d9c17d;
  font-size: clamp(13px, 3vw, 16px);
  letter-spacing: 0.18em;
}

.draw-screen h1 {
  margin: 0 auto 12px;
  font-size: clamp(24px, 6vw, 42px);
  font-weight: 500;
  letter-spacing: 0.12em;
}

.draw-screen p {
  margin: 0 auto 32px;
  color: #d9caa5;
  font-size: clamp(14px, 3.5vw, 20px);
  line-height: 1.8;
}

/* =========================
   カード裏面・めくり演出
========================= */

.card-back-button {
  display: inline-block;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  filter: drop-shadow(0 0 24px rgba(214, 179, 89, 0.35));
}

.card-back-button:focus-visible {
  outline: 2px solid rgba(215, 181, 94, 0.9);
  outline-offset: 8px;
}

.card-back-button:hover .flip-card {
  transform: translateY(-6px) scale(1.02);
  filter: brightness(1.08);
}

.flip-card-button {
  perspective: 1200px;
}

.flip-card {
  width: min(62vw, 360px);
  aspect-ratio: 933 / 1417;
  margin: 0 auto;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.22, 0.8, 0.28, 1);
}

.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 18px;
  overflow: hidden;
  filter: drop-shadow(0 0 24px rgba(214, 179, 89, 0.35));
}

.flip-card-front {
  transform: rotateY(0deg);
}

.flip-card-back {
  transform: rotateY(180deg);
}

.flip-card-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.flip-card .card-back {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
}


.card-back-button.is-shuffling .flip-card {
  animation: oneCardShuffle 0.95s ease-in-out;
}

.card-back-button.is-shuffling::after {
  content: "シャッフル中…";
  display: block;
  margin-top: 16px;
  color: #d9c17d;
  font-size: clamp(14px, 3.5vw, 18px);
  letter-spacing: 0.14em;
  text-align: center;
  text-shadow: 0 0 10px rgba(215, 181, 94, 0.45);
}

@keyframes oneCardShuffle {
  0% {
    transform: translateX(0) rotate(0deg) scale(1);
    filter: brightness(1);
  }
  18% {
    transform: translateX(-18px) rotate(-5deg) scale(1.02);
    filter: brightness(1.08);
  }
  36% {
    transform: translateX(20px) rotate(5deg) scale(1.02);
  }
  54% {
    transform: translateX(-14px) rotate(-4deg) scale(1.03);
    filter: brightness(1.16);
  }
  72% {
    transform: translateX(12px) rotate(3deg) scale(1.02);
  }
  100% {
    transform: translateX(0) rotate(0deg) scale(1);
    filter: brightness(1);
  }
}

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

.main-button,
.sub-button {
  display: block;
  margin: 24px auto 0;
  min-width: 220px;
  padding: 14px 24px;
  border: 1px solid rgba(215, 181, 94, 0.8);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(30, 28, 42, 0.95), rgba(5, 6, 14, 0.95));
  color: #f5ead0;
  box-shadow: 0 0 18px rgba(215, 181, 94, 0.18);
  cursor: pointer;
}

.main-button:hover,
.sub-button:hover {
  filter: brightness(1.12);
}

.sub-button {
  margin-top: 14px;
  opacity: 0.8;
}

/* =========================
   結果画面
========================= */

.result-label {
  margin: 8px auto 16px;
  color: #d9c17d;
  letter-spacing: 0.16em;
}

.result-card {
  width: min(72vw, 360px);
  height: auto;
  border-radius: 18px;
  filter: drop-shadow(0 0 28px rgba(214, 179, 89, 0.3));
}

.result-card-number {
  margin: 24px auto 4px;
  color: #f5ead0;
  font-size: clamp(32px, 8vw, 64px);
  letter-spacing: 0.18em;
  line-height: 1.1;
  text-align: center;
}

.result-card-title {
  margin: 0 auto 12px;
  color: #f5ead0;
  font-size: clamp(26px, 6.5vw, 52px);
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-align: center;
}

.keywords {
  margin: 0 auto 16px;
  color: #d9c17d;
  font-size: clamp(15px, 3.5vw, 20px);
}

.category-messages {
  width: 100%;
  max-width: 100%;
  margin: 32px auto 0;
  display: grid;
  gap: 18px;
}

.category-card {
  width: 100%;
  max-width: 100%;
  overflow-wrap: break-word;
  padding: 18px 18px 20px;
  border: 1px solid rgba(215, 181, 94, 0.35);
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(70, 95, 170, 0.22), transparent 45%),
    rgba(8, 10, 24, 0.72);
  box-shadow:
    0 0 18px rgba(215, 181, 94, 0.08),
    inset 0 0 18px rgba(255, 255, 255, 0.03);
  text-align: left;
}

.category-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.category-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 8px rgba(215, 181, 94, 0.25));
}

.category-heading h3 {
  margin: 0;
  color: #d9c17d;
  font-size: clamp(20px, 4.4vw, 28px);
  letter-spacing: 0.08em;
}

.category-card p {
  margin: 0;
  color: #f3ead7;
  font-size: clamp(15px, 3.8vw, 19px);
  line-height: 1.85;
}

/* =========================
   PC表示補正
========================= */

@media (min-width: 900px) {
  .screen {
    width: min(100vw, 640px);
  }

  .title-image {
    object-fit: contain;
    background: #03040c;
  }

  .hotspot {
    width: 34%;
  }
}

/* =========================
   スマホ表示補正
========================= */

@media (max-width: 600px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  .app,
  .screen,
  .draw-screen,
  .result-screen {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .draw-screen,
  .result-screen {
    padding: 24px 16px;
  }

  .flip-card {
    width: min(64vw, 280px);
  }

  .result-card {
    width: min(74vw, 320px);
    max-width: 100%;
    height: auto;
    margin: 0 auto;
  }

  .result-card-number {
    font-size: clamp(34px, 10vw, 48px);
  }

  .result-card-title {
    font-size: clamp(24px, 7vw, 36px);
  }

  .category-messages {
    width: 100%;
    gap: 14px;
  }

  .category-card {
    padding: 16px 14px 18px;
    border-radius: 16px;
  }

  .category-icon {
    width: 42px;
    height: 42px;
  }

  .main-button,
  .sub-button {
    width: min(82vw, 300px);
    min-width: 0;
  }
}


/* =========================
   3枚占いページ
========================= */

.three-draw-screen .one-page-header {
  margin-bottom: 22px;
}

.three-card-board {
  width: min(96%, 600px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: start;
}

.three-card-slot {
  text-align: center;
}

.three-position-label {
  margin: 0 0 10px;
  color: #d9c17d;
  font-size: clamp(16px, 4vw, 22px);
  letter-spacing: 0.18em;
}

.three-card-button {
  display: inline-block;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  perspective: 1200px;
}

.three-card-button:focus-visible {
  outline: 2px solid rgba(215, 181, 94, 0.9);
  outline-offset: 8px;
  border-radius: 14px;
}

.three-card-button:hover .three-flip-card {
  transform: translateY(-5px) scale(1.03);
  filter: brightness(1.08);
}

.three-card-button.is-opened {
  cursor: default;
}

.three-card-button.is-shuffling .three-flip-card {
  animation: threeCardShuffle 0.85s ease-in-out;
}

.three-card-button.is-shuffling::after {
  content: "shuffle";
  display: block;
  margin-top: 8px;
  color: #d9c17d;
  font-size: 11px;
  letter-spacing: 0.08em;
  opacity: 0.85;
  text-shadow: 0 0 8px rgba(215, 181, 94, 0.42);
}

@keyframes threeCardShuffle {
  0% { transform: translateX(0) rotate(0deg) scale(1); filter: brightness(1); }
  20% { transform: translateX(-10px) rotate(-5deg) scale(1.03); filter: brightness(1.08); }
  40% { transform: translateX(11px) rotate(5deg) scale(1.03); }
  60% { transform: translateX(-8px) rotate(-4deg) scale(1.04); filter: brightness(1.14); }
  80% { transform: translateX(7px) rotate(3deg) scale(1.02); }
  100% { transform: translateX(0) rotate(0deg) scale(1); filter: brightness(1); }
}

.three-flip-card {
  width: min(27vw, 150px);
  aspect-ratio: 933 / 1417;
  margin: 0 auto;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.three-flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.22, 0.8, 0.28, 1);
}

.three-flip-card.is-flipped .three-flip-card-inner {
  transform: rotateY(180deg);
}

.three-flip-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 12px;
  overflow: hidden;
  filter: drop-shadow(0 0 18px rgba(214, 179, 89, 0.28));
}

.three-flip-card-front {
  transform: rotateY(0deg);
}

.three-flip-card-back {
  transform: rotateY(180deg);
}

.three-flip-card-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.is-reversed-image {
  transform: rotate(180deg);
}

.three-draw-hint {
  margin: 24px auto 0;
  color: #d9caa5;
  font-size: clamp(13px, 3.4vw, 16px);
}

.three-result-screen {
  background:
    radial-gradient(circle at center top, rgba(78, 78, 160, 0.34), transparent 46%),
    radial-gradient(circle at center 32%, rgba(214, 176, 93, 0.16), transparent 42%),
    linear-gradient(180deg, #050713, #02030a 72%);
}

.three-result-screen .result-label {
  margin-top: 12px;
  text-shadow: 0 0 14px rgba(217, 193, 125, 0.28);
}

.three-result-list {
  width: 100%;
  max-width: 100%;
  display: grid;
  gap: 24px;
  margin: 24px auto 0;
}

.three-result-card {
  width: 100%;
  max-width: 100%;
  padding: 18px;
  border: 1px solid rgba(215, 181, 94, 0.42);
  border-radius: 20px;
  background:
    radial-gradient(circle at top left, rgba(70, 95, 170, 0.24), transparent 45%),
    linear-gradient(180deg, rgba(12, 15, 34, 0.82), rgba(6, 7, 18, 0.78));
  box-shadow:
    0 0 22px rgba(215, 181, 94, 0.11),
    inset 0 0 18px rgba(255, 255, 255, 0.035);
  text-align: left;
}

.three-result-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.three-position-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 8px rgba(215, 181, 94, 0.25));
}

.three-result-position {
  margin: 0;
  color: #d9c17d;
  font-size: clamp(22px, 5vw, 30px);
  letter-spacing: 0.12em;
}

.three-result-orientation {
  margin: 4px 0 0;
  color: #f3ead7;
  font-size: clamp(13px, 3.5vw, 16px);
  opacity: 0.86;
}

.three-result-body {
  display: grid;
  grid-template-columns: 36% 1fr;
  gap: 16px;
  align-items: center;
}

.three-result-card-image {
  width: 100%;
  height: auto;
  border-radius: 14px;
  filter: drop-shadow(0 0 22px rgba(214, 179, 89, 0.25));
}

.three-result-text {
  min-width: 0;
}

.three-number {
  margin-top: 0;
  font-size: clamp(24px, 6vw, 42px);
  text-align: left;
}

.three-title {
  margin-bottom: 8px;
  font-size: clamp(18px, 4.8vw, 28px);
  text-align: left;
}

.three-message {
  margin: 12px 0 0;
  color: #f3ead7;
  font-size: clamp(14px, 3.7vw, 18px);
  line-height: 1.85;
}

@media (max-width: 600px) {
  .three-card-board {
    width: 100%;
    gap: 8px;
  }

  .three-flip-card {
    width: min(28vw, 112px);
  }

  .three-position-label {
    font-size: clamp(15px, 4.4vw, 18px);
    letter-spacing: 0.12em;
  }

  .three-result-card {
    padding: 16px 14px 18px;
  }

  .three-position-icon {
    width: 46px;
    height: 46px;
  }

  .three-result-body {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .three-result-card-image {
    width: min(56vw, 230px);
    margin: 0 auto;
    display: block;
  }

  .three-number,
  .three-title {
    text-align: center;
  }

  .three-message {
    text-align: left;
  }
}


/* =========================
   X共有ボタン
========================= */

.share-button {
  display: block;
  margin: 18px auto 0;
  min-width: 220px;
  padding: 14px 24px;
  border: 1px solid rgba(120, 180, 255, 0.8);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(20, 35, 65, 0.95), rgba(5, 8, 18, 0.95));
  color: #f5ead0;
  box-shadow:
    0 0 18px rgba(120, 180, 255, 0.18),
    inset 0 0 12px rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.share-button:hover {
  filter: brightness(1.12);
}

@media (max-width: 600px) {
  .share-button {
    width: min(82vw, 300px);
    min-width: 0;
  }
}


/* 投稿用アクションボタン */
.result-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 20px auto 8px;
}

.result-action-button,
.result-action-buttons .share-button {
  margin: 0;
}

.result-action-button {
  border: 1px solid rgba(214, 176, 93, 0.78);
  border-radius: 999px;
  padding: 10px 18px;
  background: rgba(18, 20, 45, 0.78);
  color: #fff4c8;
  font-family: inherit;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(214, 176, 93, 0.16);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.result-action-button:hover {
  transform: translateY(-2px);
  background: rgba(36, 39, 82, 0.86);
  box-shadow: 0 0 22px rgba(214, 176, 93, 0.26);
}

.share-help-text {
  max-width: 620px;
  margin: 8px auto 18px;
  color: rgba(255, 244, 200, 0.72);
  font-size: 0.82rem;
  line-height: 1.7;
  text-align: center;
}

.toast-message {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1000;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: 11px 18px;
  border: 1px solid rgba(214, 176, 93, 0.72);
  border-radius: 999px;
  background: rgba(14, 12, 28, 0.92);
  color: #fff4c8;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.34);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast-message.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 560px) {
  .result-action-buttons {
    gap: 8px;
  }

  .result-action-button,
  .result-action-buttons .share-button {
    width: calc(50% - 6px);
    padding: 10px 8px;
    font-size: 0.82rem;
  }
}
