/* path: /web/styles.css */

/* 体感を軽くするために重いフィルタやシャドウを少し控えめに調整 */
:root {
  color-scheme: light dark;
  font-family: 'Noto Sans JP', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #101418;
  color: #f3f5f7;
  --accent: #ff4d6d;
  --accent-strong: #ff8fa3;
  --surface: rgba(20, 26, 32, .76);
  --border: rgba(255, 255, 255, .08);
  --background-image: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background:
    radial-gradient(circle at top, rgba(255, 77, 109, 0.2), transparent 60%),
    radial-gradient(circle at bottom, rgba(255, 143, 163, 0.16), transparent 55%),
    #0b0f13;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -5%;
  background-image: var(--background-image);
  background-size: cover;
  background-position: center;
  opacity: .9;
  filter: blur(10px) saturate(115%);
  /* 18px→10px に削減 */
  transform: scale(1.03);
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(255, 77, 109, .02);
  pointer-events: none;
  z-index: -1;
}

.app {
  width: min(98vw, 920px);
  padding: .9rem;
  border-radius: 12px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  /* 12→8 */
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .32);
  /* シャドウ控えめ */
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.app__title {
  margin: 0;
  font-size: 2rem;
  text-align: center;
  color: var(--accent-strong);
  font-family: 'Pacifico', cursive;
  letter-spacing: .6px;
}

.card-stack {
  position: relative;
  min-height: 82vh;
  display: grid;
}

.card-stack>* {
  grid-area: 1 / 1;
}

.card-stack__deck {
  position: relative;
  min-height: inherit;
}

.card {
  background: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
  touch-action: none;
}

.card-stack__deck .card#card {
  position: relative;
  z-index: 1;
}

/* 写真エリア：さらに縦長に、四隅角丸 */
.card__image-wrapper {
  position: relative;
  padding-top: 160%;
  border-radius: 24px;
  overflow: visible;
  --card-back1: none;
  --card-back2: none;
  contain: layout paint;
  /* 再描画を局所化 */
}

/* main */
.card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 24px;
  will-change: transform;
  /* transform 更新のみ */
  transition: transform 120ms ease;
}

/* 背面の2枚（画像は別URLのみ） */
.card__image-wrapper::before,
.card__image-wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  border-radius: 24px;
  z-index: -2;
  transform-origin: 50% 85%;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .28);
  /* 軽量化 */
}

.card__image-wrapper::before {
  background-image: var(--card-back1);
  transform: translate(-14px, 14px) rotate(-6deg) scale(.985);
  filter: brightness(.95);
}

.card__image-wrapper::after {
  background-image: var(--card-back2);
  z-index: -3;
  transform: translate(16px, 22px) rotate(5deg) scale(.96);
  filter: brightness(.9) saturate(.98);
}

/* 左上の名前バッジ */
.card__name-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, .25));
  color: #fff;
  padding: .45rem .9rem;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 600;
  backdrop-filter: blur(4px) saturate(115%);
  /* 6→4 */
  box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
  pointer-events: none;
  z-index: 5;
  max-width: 85%;
}

/* プレビューカード */
.card--preview {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(10px) scale(.96);
  transition: opacity 160ms ease, transform 200ms ease, filter 160ms ease;
  pointer-events: none;
  z-index: 0;
}

.card--preview.is-visible {
  opacity: 1;
  transform: translateY(16px) scale(.94);
}

/* メタは非表示 */
.card__meta {
  display: none;
}

/* 状態 */
.status {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 1rem;
  border-radius: 16px;
  padding: 2rem 1rem;
  border: 1px solid transparent;
  position: relative;
  z-index: 2;
}

.status[hidden] {
  display: none !important;
}

.status--loading {
  border-color: rgba(255, 255, 255, .08);
  background: rgba(12, 16, 20, .45);
}

.status--loading p {
  margin: 0;
  font-size: .95rem;
  color: rgba(255, 255, 255, .8);
  animation: blink 1000ms steps(1, start) infinite;
}

@keyframes blink {
  50% {
    opacity: .06
  }

  100% {
    opacity: 1
  }
}

/* 福田ぼかし */
.is-blur-fade .card__image-wrapper,
.is-blur-fade #card-image {
  animation: blurFadeIn .24s ease both;
}

.is-blur-fade.card-exit .card__image-wrapper,
.is-blur-fade.card-exit #card-image {
  animation: blurFadeOut .24s ease both;
}

@keyframes blurFadeIn {
  from {
    filter: blur(5px);
    opacity: 0;
  }

  to {
    filter: blur(0);
    opacity: 1;
  }
}

@keyframes blurFadeOut {
  from {
    filter: blur(0);
    opacity: 1;
  }

  to {
    filter: blur(7px);
    opacity: 0;
  }
}

/* アクションボタン非表示 */
.actions {
  display: none !important;
}

@media (max-width:520px) {
  .app {
    width: min(95vw, 380px);
  }
}