@charset "UTF-8";
/* ============================================================
   CSS カスタムプロパティ
   ============================================================ */
:root {
  --header-h: 60px;
  --footer-h: 60px;
}

@media screen and (max-width: 1000px) {
  :root {
    --header-h: 80px;
  }
}
/* ============================================================
   site-wide の main { display:grid } を上書き
   ============================================================ */
main {
  display: block;
  padding-top: 0 !important;
}

/* site-wide の body{height:100vh} は iOS Safari だと「ツールバーが
   隠れた時の最大サイズ」で固定されてしまい、ツールバー表示中の実際の
   表示領域(100dvh)より大きくなる。すると body 全体がページの一部として
   スクロール可能になり、ツールバーの出し引きのたびに #game-section 上部
   （お題表示）が見えたり隠れたりする不具合が起きるため、動的な dvh に揃える。 */
body {
  height: 100dvh;
}

/* ============================================================
   リセット・基本設定
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  font-family: "Noto Sans JP", sans-serif;
  overflow-x: hidden;
}

/* ============================================================
   ゲーム中：ヘッダー・フッター非表示・ゲームエリア全画面化
   ============================================================ */
body.game-active header,
body.game-active footer {
  display: none;
}
body.game-active #game-section {
  height: 100dvh;
}

/* ============================================================
   ゲームセクション（和菓子屋の縁側・春がすみ背景）
   ============================================================ */
#game-section {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: calc(100dvh - var(--header-h) - var(--footer-h));
  min-height: min(480px, 100dvh);
  background: linear-gradient(180deg, #fdf3e7 0%, #fbe8ee 55%, #f7d9e4 100%);
  touch-action: none;
}

/* PixiJS canvas — 透過背景でゲームセクション全体を覆う */
canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: block;
}

/* ふわふわ舞う花びら（CSS アニメーション） */
#petal-field {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.petal {
  position: absolute;
  border-radius: 60% 40% 55% 45% / 45% 55% 40% 60%;
  background: rgba(255, 182, 199, 0.55);
  animation: petal-fall linear infinite;
}

@keyframes petal-fall {
  0% {
    transform: translateY(-8vh) translateX(0) rotate(0deg);
  }
  100% {
    transform: translateY(108vh) translateX(var(--drift, 30px)) rotate(360deg);
  }
}

/* ============================================================
   スタートセクション（ページレイアウト）
   ============================================================ */
#start-section {
  max-width: 560px;
  margin: 32px auto;
  padding: 0 8px 10px;
}

.game-intro-box {
  background: #fdf9f2;
  border: 1px solid #d9a8b8;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.intro-body {
  padding: 0 22px 24px;
}

.intro-body .breadcrumb {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin-bottom: 0.6em;
  font-size: 16px;
  color: #666;
}
@media (max-width: 1000px) {
  .intro-body .breadcrumb {
    padding-top: 10px !important;
  }
}
.intro-body .breadcrumb li:not(:last-of-type)::after {
  content: "》";
  margin: 0 0.4em;
  color: #aaa;
}

.game-intro-box > .section {
  padding: 0.6em 14px 0;
  font-size: 13px;
  background: none !important;
  box-shadow: none;
}

/* ============================================================
   h1
   ============================================================ */
.game-title {
  font-family: "noto-sans-pro", sans-serif;
  font-size: 1.3rem;
  font-weight: bold;
  color: #333;
  border-top: 3px solid #b82343;
  border-bottom: 3px solid #b82343;
  background: #fff;
  padding: 1rem 0.5rem 0.75rem;
  margin: 0 0 0.8em;
}

/* ============================================================
   ルール説明
   ============================================================ */
.rules-list {
  list-style: disc;
  margin-bottom: 1em;
  font-size: 1rem;
  color: #333;
}

.rules-list li {
  padding-left: 25px;
  background: url(../img/sakura.svg);
  background-position: 0 6px;
  background-size: 1em;
  background-repeat: no-repeat;
  line-height: 1.8;
  font-size: 1em;
  margin-bottom: 0.5em;
}

/* ============================================================
   操作説明ボックス
   ============================================================ */
.how-to-box {
  font-size: 12px;
  color: #555;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 14px;
}

.how-to-box > div {
  margin-bottom: 3px;
}

.how-to-box > div:last-child {
  margin-bottom: 0;
}

.key {
  display: inline-block;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 11px;
  color: #444;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}

/* ============================================================
   難易度セレクター
   ============================================================ */
.diff-section {
  margin-bottom: 16px;
}

.diff-label {
  font-size: 13px;
  color: #555;
  font-weight: bold;
  margin-bottom: 7px;
  text-align: center;
}

.diff-row {
  display: flex;
  justify-content: center;
}

.diff-btn {
  padding: 8px 16px;
  margin: 0 5px;
  background: #ecf0f1;
  border: 2px solid #bdc3c7;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  transition: all 0.3s;
}

.diff-btn.selected {
  background: #d4699a;
  color: white;
  border-color: #d4699a;
}

.diff-btn:hover:not(.selected) {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   はじめるボタン
   ============================================================ */
.action-btn {
  display: block;
  margin: 0 auto;
  background-color: #b82343;
  padding: 6px 20px;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  transition: opacity 0.15s;
}

.action-btn:hover {
  opacity: 0.85;
}

.hidden {
  display: none !important;
}

/* ============================================================
   お題表示
   ============================================================ */
#odai-area {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  text-align: center;
  pointer-events: none;
}

#odai-label {
  font-size: 11px;
  color: #a8577a;
  font-weight: 700;
  letter-spacing: 0.2em;
  margin-bottom: 2px;
}

#odai-text {
  font-family: "Noto Serif JP", serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #7a2645;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid #d9a8b8;
  border-radius: 999px;
  padding: 6px 22px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}

/* 進捗ドット（次に刺すべき番号を示す） */
#progress-dots {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid #d9a8b8;
  transition: background 0.2s, transform 0.2s;
}

.progress-dot.done {
  background: #d4699a;
  border-color: #d4699a;
  transform: scale(1.15);
}

/* やさしいモード用ヒント（次に刺す言葉の一文字目） */
#hint-text {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #a8577a;
  background: rgba(255, 255, 255, 0.75);
  border: 1.5px solid #d9a8b8;
  border-radius: 999px;
  padding: 2px 12px;
  display: inline-block;
}

/* ============================================================
   ゲームオーバー / クリアメッセージ
   ============================================================ */
#gameover-msg,
#clear-msg {
  position: absolute;
  inset: 0;
  width: fit-content;
  height: fit-content;
  margin: auto;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
  font-family: "Noto Serif JP", serif;
  font-size: min(2.8rem, 10.5dvh);
  font-weight: 700;
  letter-spacing: 0.1em;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
}

#gameover-msg {
  color: #7a2645;
  text-shadow: 0 0 18px rgba(255, 150, 180, 0.9), 2px 2px 6px rgba(0, 0, 0, 0.35);
}

#clear-msg {
  color: #d4699a;
  text-shadow: 0 0 24px rgba(255, 200, 220, 1), 0 0 8px rgba(255, 160, 190, 0.9), 2px 2px 6px rgba(0, 0, 0, 0.25);
}

/* ============================================================
   串だんご完成時：歌の全文を一瞬表示
   ============================================================ */
#poem-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 45;
  pointer-events: none;
  opacity: 0;
}

#poem-reveal-paper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 250, 240, 0.9);
  border: 2px solid #d9a8b8;
  border-radius: 8px;
  padding: 14px 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

#poem-reveal-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
  font-family: "Noto Serif JP", serif;
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 700;
  color: #4a2f10;
  letter-spacing: 0.15em;
  line-height: 2.1;
}

#poem-reveal-poet {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
  font-family: "Noto Serif JP", serif;
  font-size: 12px;
  font-weight: 400;
  color: #7a2645;
  letter-spacing: 0.1em;
}

/* ============================================================
   札エリア
   ============================================================ */
#card-area {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* 札（短冊風・序詞の句が入るタグ。高さは文字数に応じてJSが可変で設定する） */
.card {
  position: absolute;
  top: 0;
  left: 0;
  width: 56px;
  min-height: 56px;
  background: linear-gradient(160deg, #fffaf0 0%, #f7e8cf 100%);
  border: 5px solid #a8763f;
  border-radius: 8px;
  box-shadow: 3px 5px 14px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 5px;
  pointer-events: none;
  opacity: 0;
}

.card-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: "Noto Serif JP", serif;
  font-size: 17px;
  font-weight: 700;
  color: #4a2f10;
  line-height: 1.3;
  letter-spacing: 0.03em;
  white-space: nowrap;
  text-align: left;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card.correct-flash {
  border-color: #6fb26f;
  box-shadow: 3px 5px 14px rgba(0, 0, 0, 0.3), 0 0 18px rgba(111, 178, 111, 0.7);
}

.card.wrong-flash {
  border-color: #c0392b;
  box-shadow: 3px 5px 14px rgba(0, 0, 0, 0.3), 0 0 18px rgba(192, 57, 43, 0.7);
}

/* 串と横位置が合っている札のハイライト */
.card.aligned {
  border-color: #d4699a;
  box-shadow: 3px 5px 14px rgba(0, 0, 0, 0.3), 0 0 16px rgba(212, 105, 154, 0.65);
}

@media screen and (min-width: 1001px) {
  .card {
    width: 70px;
    min-height: 70px;
    border-width: 5px;
    padding: 10px 6px;
  }
  .card-text {
    font-size: 22px;
    line-height: 1.3;
  }
  #start-section {
    max-width: 820px;
  }
  .game-intro-box {
    width: 800px;
    padding: 1.5em 1em 1em 1em;
  }
  .game-intro-box > .section {
    background: none;
    box-shadow: none;
  }
  .game-intro-box > .section li {
    font-size: 16px;
    line-height: 1.8;
  }
  .game-intro-box > .section {
    padding: 0;
    font-size: 13px;
  }
}

/* ============================================================
   串だんごエリア（左右に移動する。left はJSが中心座標を設定する）
   ============================================================ */
#dango-area {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: 60px;
  height: 210px;
  pointer-events: none;
}

/* 串は団子スタックの背後を貫通させ、上下に少し串先が覗くようにする */
#kushi {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 100%;
  background: linear-gradient(90deg, #c9a15c 0%, #a8763f 45%, #8a5f2e 100%);
  border-radius: 4px;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

/* 団子は串より手前に重ね、串の持ち手分だけ底上げする */
#dango-stack {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  z-index: 2;
}

.dango-ball {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  margin-bottom: -6px;
  box-shadow: inset -4px -5px 8px rgba(0, 0, 0, 0.18), inset 3px 3px 6px rgba(255, 255, 255, 0.5), 2px 3px 6px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.dango-ball.color-pink  { background: radial-gradient(circle at 35% 30%, #ffd6e2, #ff9fbb 70%, #f582a3); }
.dango-ball.color-white { background: radial-gradient(circle at 35% 30%, #ffffff, #fdf6ea 70%, #f0e6d2); }
.dango-ball.color-green { background: radial-gradient(circle at 35% 30%, #d4f0c0, #9bc97e 70%, #7fae63); }

@media screen and (min-width: 1001px) {
  #dango-area { width: 72px; height: 260px; }
  #dango-stack { bottom: 46px; }
  .dango-ball { width: 56px; height: 56px; margin-bottom: -7px; }
}

/* ============================================================
   レスポンシブ — スマホ（≤600px）
   ============================================================ */
@media (max-width: 600px) {
  .card {
    width: 44px;
    min-height: 44px;
    border-width: 4px;
    padding: 6px 4px;
  }
  .card-text {
    font-size: 15px;
    line-height: 1.3;
  }
  #odai-text {
    font-size: 1.05rem;
    padding: 5px 16px;
  }
  #dango-area {
    height: 185px;
  }
  #dango-stack {
    bottom: 30px;
  }
  .dango-ball {
    width: 40px;
    height: 40px;
    margin-bottom: -5px;
  }
  #start-section {
    margin: 16px auto;
  }
}
