﻿@charset "UTF-8";
@import url(https://fonts.googleapis.com/icon?family=Material+Icons);
p.omikuji-explanation {
  font-family: "Optima", "noto-sans-jp", sans-serif;
  text-align: center!important;
  font-size:0.9rem!important;
  line-height:1.8!important;
}
@media(max-width:768px){
  p.omikuji-explanation {
    text-align:left!important;
  }
}

/* おみくじ箱のコンテナを中央寄せ */
#omikuji-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: padding-bottom 0.6s ease-out;
}

#omikuji-container.stick-out {
  padding-bottom: 86px; /* 20px(元) + 66px(棒の突出量) */
}


/* おみくじ箱 */
#omikuji-box {
  margin-bottom: 20px;
  position: relative;
  display: inline-block;
  transform-origin: center;
}

/* 背面画像（z-index: 0）*/
#omikuji-image-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 200px;
  height: auto;
  display: block;
  z-index: 0;
}

/* 前面画像（z-index: 2）。この画像がボックスの高さを決める */
#omikuji-image-front {
  display: block;
  width: 200px;
  height: auto;
  position: relative;
  z-index: 2;
}


@media (max-width: 760px) {
  #omikuji-image-back,
  #omikuji-image-front {
    width: 150px;
  }
}

/*
  180°回転後の座標変換:
    top: 0 (LOCAL上端) → 回転後はビジュアル下端（穴の位置）になる
    translateY(+N)    → LOCAL下方向 = ビジュアル上方向 = 箱の内部（非表示）
    translateY(-N)    → LOCAL上方向 = ビジュアル下方向 = 箱の外（表示）
*/
#omikuji-stick-wrap {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -8px;
  transform: translateY(120px);  /* 初期状態: 箱の内部に隠れている */
  z-index: 1;
}

#omikuji-stick {
  width: 16px;
  height: 120px;
  background: linear-gradient(to right, #a07818, #f0d060, #d4a830, #a07818);
  border-radius: 5px 5px 2px 2px;  /* LOCAL上端（=ビジュアル先端）を丸く */
  box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 6px;
}

#omikuji-stick-number {
  font-size: 9px;
  font-weight: bold;
  color: #3a1800;
  writing-mode: vertical-rl;
  line-height: 1.2;
  letter-spacing: 1px;
  display: inline-block;
  transform: rotate(180deg);  /* 親の180°回転を打ち消して文字を正立させる */
}

/* 180°反転 → コトコト揺れ → ピタッと静止 */
@keyframes boxFlipShake {
  0%   { transform: rotate(0deg); }
  18%  { transform: rotate(180deg); }
  28%  { transform: rotate(174deg); }
  38%  { transform: rotate(186deg); }
  48%  { transform: rotate(174deg); }
  58%  { transform: rotate(186deg); }
  68%  { transform: rotate(174deg); }
  78%  { transform: rotate(186deg); }
  88%  { transform: rotate(174deg); }
  96%  { transform: rotate(180deg); }
  100% { transform: rotate(180deg); }
}

.is-flipping {
  animation: boxFlipShake 1.5s ease-in-out forwards;
}

/* 棒がするっと下に出てくるアニメーション（引っ込みなし） */
@keyframes stickPop {
  from { transform: translateY(120px); }  /* 箱の内部 */
  to   { transform: translateY(-66px); }  /* 66px分がビジュアル下に出る */
}

#omikuji-stick-wrap.stick-out {
  animation: stickPop 0.6s ease-out forwards;
}

/* ボタンのスタイル（任意） */
#draw-button,
#reset-button,
#poem-link-btn {
  padding: 8px 15px;
  font-size: 1em;
  cursor: pointer;
  border: none;
  border-radius: 5px;
  background-color: #b82343;
  color: white;
  box-shadow: 0 4px #8e1c35;
  transition: background-color 0.3s;
}

#draw-button:hover,
#reset-button:hover {
  background-color: #8e1c35;
}

.result-btn-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 1em;
}

#poem-link-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  background-color: #007e5e;
  box-shadow: 0 4px #005e46;
}

#poem-link-btn:hover {
  background-color: #005e46;
}

#draw-button:disabled {
  background-color: #aaa;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

/* 結果表示エリア（紙のスタイル） */
#result-area {
  width: 97%;
  max-width: 800px;
  margin: 10px auto;
  padding: 32px 28px;
  border: 1px solid #c8a96e;
  border-radius: 2px;
  background-color: #fffef8;
  text-align: center;
  box-shadow: 3px 8px 24px rgba(0, 0, 0, 0.18), 0 2px 4px rgba(0, 0, 0, 0.08);
  position: relative;
}

/* するする：紙が上から伸びてくる */
@keyframes paperSlide {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0% 0); }
}

/* ふわっ：紙がわずかに膨らんで落ち着く */
@keyframes paperBloom {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.018); }
  100% { transform: scale(1); }
}

#result-area.paper-sliding {
  animation: paperSlide 0.65s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#result-area.paper-blooming {
  animation: paperBloom 0.5s ease-out forwards;
}

/* 和歌の画像（カード） */
.waka-card-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 15px 0 0;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

@media (min-width: 750px) {
  /* PC: 画像を和歌の左側に並べる。高さは#waka-poemの実測値をJSで.waka-card-imageに反映する */
  #waka-row {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    justify-content: center;
    gap: 24px;
  }

  #waka-content {
    flex: 0 1 480px;
  }

  .waka-card-image {
    width: 260px;
    height: auto;
    margin: 10px 0 0;
    flex-shrink: 0;
    object-fit: contain;
    background-color: #fffaf0;
  }
}

/* 和歌の表示 */
#waka-poem {
  background-color: #fffaf0;
  padding: 20px;
  border: 1px solid #333;
  margin-top: 10px;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.poem-number {
  position: absolute;
  bottom: 6px;
  left: 8px;
  font-size: 0.65em;
  color: #999;
  writing-mode: horizontal-tb;
  font-family: "Noto Sans JP", sans-serif;
  line-height: 1;
}

.poem {
  font-family: "Kaisei HarunoUmi", serif;
  margin: 15px auto;
  line-height: 1.8;
  display: flex;
  justify-content: center;
  align-items: center;
}

.waka-body {
  writing-mode: vertical-rl;
  text-align: start;
  font-size: 1.3em;
}

.poet-name {
  font-size: 0.75em;
  margin: 0 0 0 5px;
  writing-mode: vertical-rl;
  text-align: center;
  margin-bottom: 8px;
}

.meaning {
  font-size: 0.95em;
  color: #333;
  margin-bottom: 20px;
  white-space: pre-wrap;
  text-align: left;
}

/* 解釈のセクション */
.interpretation-section {
  margin: 0.5em 0 2em;
  padding: 10px;
  border-left: 5px solid #b82343;
  text-align: left;
  background-color: #fffaf0;
}

.interpretation-section h4 {
  color: #b82343;
  margin-top: 0;
  font-size: 1.1em;
}

/* 非表示にするクラス */
.hidden {
  display: none !important;
}

/* 結果表示エリア内の各要素の初期状態（透明）。#waka-poem は別途管理 */
#result-area h2,
#result-area hr,
#result-area h3,
#result-area .interpretation-section,
#result-area .result-btn-group,
#result-area .waka-card-image {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* JavaScriptでこのクラスを付与し、要素を表示させる */
.show-item {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* 和歌：初期状態（中央に巻かれた状態） */
#waka-poem {
  opacity: 0;
  clip-path: inset(0 50% 0 50%);
  transition: none;
}

/* 巻物がするすると開いてふわっと落ち着くアニメーション */
@keyframes scrollUnroll {
  0% {
    clip-path: inset(0 50% 0 50%);
    opacity: 0;
    transform: scale(1);
  }
  12% {
    opacity: 1;
  }
  62% {
    clip-path: inset(0 0% 0 0%);
    transform: scale(1);
  }
  78% {
    clip-path: inset(0 0% 0 0%);
    transform: scale(1.018);
  }
  100% {
    clip-path: inset(0 0% 0 0%);
    transform: scale(1);
    opacity: 1;
  }
}

#waka-poem.show-item {
  animation: scrollUnroll 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
  opacity: 1 !important;
  transform: none !important;
}

h2 {
  font-family: "Kaisei HarunoUmi", serif;
  font-weight: normal;
  color: #b82343;
}

#waka-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

#poet-image {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid #c8a96e;
  flex-shrink: 0;
}

p {
  font-size: 1em;
  margin-top: 0.5em;
}

#interp-love,
#interp-work {
  white-space: pre-wrap;
}

/* ローマ字切り替えボタン（英語版） */
#romaji-toggle-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  font-size: 0.72em;
  cursor: pointer;
  border: 1px solid #c8a96e;
  border-radius: 4px;
  background-color: #fffef8;
  color: #7a5a2a;
  transition: background-color 0.2s, color 0.2s;
}
#romaji-toggle-btn:hover {
  background-color: #f5e6c8;
}
#romaji-toggle-btn.active {
  background-color: #b82343;
  border-color: #b82343;
  color: #fff;
}

/* 英語版 歌人名（waka-title 直下） */
#poet-name-display {
  font-size: 0.85em;
  color: #7a5a2a;
  text-align: center;
  margin: -0.5em 0 0.5em;
  font-style: italic;
}

/* ローマ字モード時：縦書きをやめて横書きに */
#waka-poem.romaji-mode {
  letter-spacing: 0.05em;
  line-height: 1.9;
  text-align: center;
}
#waka-poem.romaji-mode .waka-body {
  writing-mode: horizontal-tb;
  text-align: center;
  width: 100%;
  font-size: 1em;
}
#waka-poem.romaji-mode .poet-name {
  display: none;
}/*# sourceMappingURL=omikuji.css.map */