/* =========================
   1. CSSリセット・変数
   ========================= */
:root {
  --color-text: #333;
  --color-gray: #ccc;
  --color-gray-dark: #888;
  --color-border: rgba(204,204,204,0.5);
  --color-choice-bg: rgba(255,255,255,0.2);
  --color-choice-bg-hover: rgba(255,255,255,0.35);
  --font-ja: YakuHanMP, 'Shippori Mincho', serif;
  --font-en: 'Inter', YakuHanJP, 'Zen Kaku Gothic New', sans-serif;
  --font-ja-sans: YakuHanJP, 'Zen Kaku Gothic New', sans-serif;
  --font-en-serif: 'Playfair', serif;
  --transition-hover-button: box-shadow 0.8s ease-out, background 0.8s ease-out, color 0.8s ease-out, filter 0.8s ease-out;
}

body {
  font-family: var(--font-ja), var(--font-en), var(--font-ja-sans), sans-serif;
  font-feature-settings: "palt" 1, "kern" 1;
  font-weight: 300;
  color: var(--color-text);
  margin: 0;
  padding: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  background: #FAFAFA;
}

/* =========================
   2. 汎用レイアウト・背景
   ========================= */
.l-bg-gradient {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.2;
  background: linear-gradient(120deg, #FBF9E2 0%, #E9A6A0 25%, #ADE7F5 50%, #A2C0F4 75%, #B390D0 100%);
  overflow: hidden;
}
.l-bg-noise {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 1;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnN2Z2pzPSJodHRwOi8vc3ZnanMuZGV2L3N2Z2pzIiB2aWV3Qm94PSIwIDAgNzAwIDcwMCIgd2lkdGg9IjcwMCIgaGVpZ2h0PSI3MDAiPjxkZWZzPjxmaWx0ZXIgaWQ9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PC9kZWZzPjxyZWN0IHdpZHRoPSI3MDAiIGhlaWdodD0iNzAwIiBmaWxsPSJ0cmFuc3BhcmVudCI+PC9yZWN0PjxyZWN0IHdpZHRoPSI3MDAiIGhlaWdodD0iNzAwIiBmaWxsPSIjNzk0NmJmIiBmaWx0ZXI9InVybCgjbm5ub2lzZS1maWx0ZXIpIj48L3JlY3Q+PC9zdmc+");
  background-repeat: repeat;
  animation: noiseMove 0.5s steps(1) infinite;
}
.o-bg-ball {
  position: absolute;
  width: 40vw;
  height: 40vw;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 1;
  pointer-events: none;
}
.o-bg-ball1 { background: #FBF9E2; }
.o-bg-ball2 { background: #E9A6A0; }
.o-bg-ball3 { background: #ADE7F5; }
.o-bg-ball4 { background: #A2C0F4; }
.o-bg-ball5 { background: #B390D0; }
@keyframes noiseMove {
  0%   { background-position: 0 0; }
  20%  { background-position: 40px 50px; }
  40%  { background-position: 20px 15px; }
  60%  { background-position: 10px 30px; }
  80%  { background-position: 80px 20px; }
  100% { background-position: 0 0; }
}
.l-content {
  position: relative;
  z-index: 2;
  width: 80%;
  margin: 0 auto;
  height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

/* =========================
   3. コンポーネント
   ========================= */
/* --- AI発話 --- */
.c-ai-utterance {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto;
  padding-bottom: 100px;
}
.c-ai-utterance.is-gone { padding-bottom: 0; }
.c-ai-utterance__ja {
  font-family: var(--font-ja);
  font-size: clamp(22px, 3vw, 40px);
  line-height: 1.6;
  text-align: center;
  letter-spacing: -0.06em;
}
.c-ai-utterance__en {
  font-family: var(--font-en);
  font-size: clamp(12px, 1.5vw, 16px);
  line-height: 1.5;
  color: var(--color-gray);
  margin-top: 8px;
  text-align: center;
  letter-spacing: 0.03em;
}

/* --- 選択肢 --- */
.c-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  position: absolute;
  left: 0;
  width: 100%;
  bottom: 60px;
}
.c-choice {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-choice-bg);
  backdrop-filter: blur(6px);
  padding: 6px 12px;
  cursor: pointer;
  transition: var(--transition-hover-button);
  outline: none;
  min-width: 0;
  box-shadow: 0px 0px 0px rgba(0,0,0,0);
  opacity: 0;
  filter: blur(10px);
  color: var(--color-text);
}
.c-choice:hover, .c-choice:focus {
  box-shadow: 2px 2px 10px rgba(0,0,0,0.05);
}
.c-choice:hover .c-choice__arrow, .c-choice:focus .c-choice__arrow{
  color: var(--color-text);
}
.c-choice__arrow {
  color: var(--color-gray);
  font-size: 8px;
  margin-right: 5px;
  font-family: var(--font-ja-sans);
  transition: var(--transition-hover-button);
}
.c-choice__ja {
  font-family: var(--font-ja-sans);
  font-size: 14px;
  margin-right: 5px;
  letter-spacing: -0.05em;
}
.c-choice__en {
  font-family: var(--font-en);
  font-size: 12px;
  color: var(--color-gray);
  letter-spacing: 0.03em;
}
.c-choice.is-visible {
  opacity: 1;
  filter: blur(0);
  transition: var(--transition-hover-button);
}

/* --- 入力欄 --- */
.c-user-input-parent {
  width: 100%;
  max-width: 400px;
  position: absolute;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
}
.c-user-input { width: 100%; }
.c-user-input__guide {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 0.5em;
}
.c-user-input__guide-ja {
  font-family: var(--font-ja-sans);
  font-size: 14px;
  line-height: 20px;
  display: inline-flex;
  align-items: center;
}
.c-user-input__guide-arrow {
  color: var(--color-gray);
  font-size: 8px;
  line-height: 20px;
  margin-right: 5px;
  font-family: var(--font-ja-sans);
  letter-spacing: 0.01em;
  transition: var(--transition-hover-button);
}
.c-user-input__guide-en {
  font-family: var(--font-en);
  font-size: 11px;
  line-height: 20px;
  color: var(--color-gray);
  letter-spacing: 0.03em;
}
.c-user-input__inner {
  display: flex;
  align-items: center;
  gap: 6px;
}
.c-user-input__field {
  flex: 1 1 0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-choice-bg);
  backdrop-filter: blur(6px);
  padding: 6px 18px 6px 12px;
  font-family: var(--font-ja-sans);
  font-size: 14px;
  outline: none;
  min-width: 180px;
  width: 100%;
  box-sizing: border-box;
  transition: var(--transition-hover-button);
  box-shadow: 0px 0px 0px rgba(0,0,0,0);
}
.c-user-input__field:focus {
  box-shadow: 2px 2px 10px rgba(0,0,0,0.05);
  background: var(--color-choice-bg-hover);
}
.c-user-input__field::placeholder {
  color: var(--color-gray);
  opacity: 1;
}
.c-user-input:has(.c-user-input__field:focus) .c-user-input__guide-arrow{
  color: var(--color-text);
}
.c-user-input__btn {
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-choice-bg);
  backdrop-filter: blur(6px);
  padding: 6px 18px;
  font-family: var(--font-en);
  font-size: 13px;
  letter-spacing: 0;
  cursor: pointer;
  transition: var(--transition-hover-button);
  box-shadow: 0px 0px 0px rgba(0,0,0,0);
  height: 36px;
  outline: none;
  min-width: 64px;
  color: var(--color-text);
}
.c-user-input__btn:hover, .c-user-input__btn:focus {
  box-shadow: 2px 2px 10px rgba(0,0,0,0.05);
  background: var(--color-choice-bg-hover);
}

/* --- ファーストスクリーン・ボタン --- */
.c-first-screen{
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.c-first-screen__title{
  font-family: var(--font-en-serif);
  font-weight: 300;
  font-size: min(12.8vw, 64px);
  letter-spacing: 0;
  margin: 0 auto;
}
.c-first-screen__subtitle{
  margin: 0 auto;
  color: var(--color-gray);
  font-weight: normal;
  font-size: 12px;
  letter-spacing: 0;
  font-family: var(--font-en);
}
.c-first-screen__btn{ margin-top: 40px; }
.c-talk-btn{
  font-family: var(--font-en);
  font-size: 16px;
  line-height: 20px;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: var(--transition-hover-button);
  box-shadow: 0px 0px 0px rgba(0,0,0,0);
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-choice-bg);
  backdrop-filter: blur(6px);
  padding: 15px 30px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-text);
}
.c-talk-btn:hover{
  box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
  background: var(--color-choice-bg-hover);
}
.c-talk-btn__ja{
  font-family: var(--font-ja-sans);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
}
.c-talk-btn__arrow{
  color: var(--color-gray);
  font-size: 8px;
  line-height: 20px;
  margin-right: 5px;
  font-family: var(--font-ja-sans);
  transition: var(--transition-hover-button);
}
.c-talk-btn:hover .c-talk-btn__arrow{ color: var(--color-text); }
.c-talk-btn__en{
  font-family: var(--font-en);
  font-size: 12px;
  color: var(--color-gray);
  letter-spacing: 0.03em;
}

/* --- 詩 --- */
.c-ai-poem {
  width: 80%;
  margin: 30px auto 0;
}
.c-ai-poem__ja {
  font-family: var(--font-ja);
  font-size: clamp(14px, 4vw, 24px);
  line-height: 1.6;
  text-align: center;
  letter-spacing: -0.06em;
}
.c-ai-poem__ja div{
  transform: skewX(-10deg);
}
.c-ai-poem__en {
  font-family: var(--font-en);
  font-size: clamp(10px, 1.5vw, 14px);
  line-height: 1.5;
  color: var(--color-gray);
  margin-top: 8px;
  text-align: center;
  letter-spacing: 0.03em;
  font-style: italic;
}

/* --- ローディング --- */
.c-loading {
  position: fixed;
  z-index: 9999;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}
.c-loading__spinner { margin-bottom: 1em; display: block; }
.c-loading__text { text-align: center; }
.c-loading__text-ja {
  font-family: var(--font-ja-sans);
  font-size: 14px;
  letter-spacing: 0.04em;
}
.c-loading__text-en {
  margin-top: 5px;
  font-family: var(--font-en);
  font-size: 12px;
  letter-spacing: 0;
  color: var(--color-gray);
}

/* --- フッター --- */
.o-footer, .footer {
  position: fixed;
  bottom: 10px;
  left: 0;
  width: 100%;
  text-align: center;
  color: var(--color-gray);
  font-size: 10px;
  z-index: 10;
  letter-spacing: 0.05em;
  opacity: 0.5;
  font-family: var(--font-en), var(--font-ja-sans), sans-serif;
}
.o-footer a, .footer a {
  color: inherit;
  text-decoration: none;
}
.o-footer a:hover, .footer a:hover {
  text-decoration: underline;
}

/* =========================
   4. ユーティリティ・状態
   ========================= */
.is-hidden {
  visibility: hidden;
}
.is-shown {
  opacity: 1 !important;
  pointer-events: auto !important;
  transition: opacity 0.5s;
}

/* =========================
   5. メディアクエリ
   ========================= */
@media (max-width: 768px) {
  .l-content { width: 90%; }
  .c-choices {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    bottom: 25px;
  }
  .c-choice { padding: 5px 10px; }
  .c-choice__ja { font-size: 12px; }
  .c-choice__en { font-size: 10px; }
  .c-user-input-parent { bottom: 40px; }
  .c-user-input { max-width: 100%; }
  .c-user-input__guide-ja { font-size: 13px; }
  .c-user-input__btn { font-size: 12px; padding: 6px 12px; min-width: 48px; height: 32px; }
  .c-user-input__field { font-size: 13px; min-width: 0; max-width: 100%; }
  .u-only-pc { display: none; }
  .c-ai-poem { width: 90%; }
}
@media (min-width: 769px) {
  .u-only-sp { display: none; }
}

/* --- 対話終了メッセージ --- */
.js-final-message-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 60px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.js-final-message-ja {
  font-family: var(--font-ja-sans);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  margin-bottom: 8px;
  white-space: pre-line;
}
.js-final-message-en {
  font-family: var(--font-en);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--color-gray);
  white-space: pre-line;
}