
.h1-badge {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

#poet-img {
  height: 2.5em;
  width: 2.5em;
  margin-right: 8px;
  border-radius: 50%;
}

#daruma-neko-area {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 560px;
  margin: 6px auto 1.2em;
}

#daruma-neko-char-wrap {
  flex-shrink: 0;
  width: 64px;
}

#daruma-neko-img {
  width: 64px;
  display: block;
  border-radius: 8px;
}

@media (min-width: 480px) {
  #daruma-neko-char-wrap { width: 80px; }
  #daruma-neko-img { width: 80px; }
}

#daruma-neko-balloon {
  position: relative;
  flex: 1;
  background: #fffef5;
  border: 2px solid #e0c060;
  border-radius: 14px;
  padding: 10px 14px;
  min-height: 1.6em;
  display: flex;
  align-items: center;
}

#daruma-neko-balloon::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 24px;
  border: 7px solid transparent;
  border-right-color: #e0c060;
}

#daruma-neko-balloon::after {
  content: "";
  position: absolute;
  left: -9px;
  top: 26px;
  border: 5px solid transparent;
  border-right-color: #fffef5;
}

#kake-instr {
  text-align: left;
  color: #555;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  line-height: 1.8;
  margin: 0;
}

/* ── 歌カード（縦書き） ───────────────────────────────────── */
.poem-card-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto 1.5em;
}

#poem-card {
  flex: 1;
  min-width: 0;
  min-height: 15em;
  background: #fffef5;
  border: 1px solid #e0c060;
  border-radius: 10px;
  padding: 1.6em 1.4em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.kake-nav-btn {
  flex-shrink: 0;
  width: 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 1.2rem;
  font-weight: bold;
  background: #b82343;
  border-radius: 6px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-decoration: none;
}
.kake-nav-btn:hover { background: #8a1a30; }
.kake-nav-btn img {
  width: 14px;
  height: 14px;
  display: block;
}

#poem-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(1.15rem, 4vw, 1.5rem);
  line-height: 2.3;
  color: #2a1200;
  letter-spacing: 0.04em;
  margin: 0;
  min-height: 8em;
  /* 歌全体を同じ指カーソルにして、掛詞の場所がカーソル形状だけでバレないようにする */
  cursor: pointer;
}
@media (max-width: 480px) {
  #poem-text {
    font-size: 1.5rem;
    font-weight: 700;
  }
}

/* 掛詞トリガー：ゲームなので周囲の文字と見た目を一切変えない（クリック領域のみ） */
.kg-trigger {
  display: inline-block;
  cursor: pointer;
}

/* ── その場でくるりんフリップ ─────────────────────────────── */
.kg-flip {
  display: inline-block;
  width: 1.3em;
  height: 3.6em;
  perspective: 800px;
  vertical-align: top;
}
/* hidden属性を display 指定より優先させる（初期状態ではフリップ面を一切見せない） */
.kg-flip[hidden] {
  display: none;
}

.kg-flip-inner {
  display: inline-block;
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.45, 0.05, 0.35, 1);
  transform-style: preserve-3d;
}

.kg-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  background: #fff9e8;
  border: 1px solid #e0c060;
  border-radius: 4px;
  font-weight: 700;
  color: #2a1200;
}
.kg-back {
  transform: rotateY(180deg);
}
.kg-face.kg-original {
  background: #b82343;
  border-color: #b82343;
  color: #fff;
}

/* ── 発見後の解説 ─────────────────────────────────────────── */
#kake-explain {
  max-width: 560px;
  margin: 0 auto 1.5em;
  background: #fff;
  border-left: 4px solid #b82343;
  border-radius: 6px;
  padding: 1.2em 1.4em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
#kake-explain.show {
  opacity: 1;
  transform: translateY(0);
}
#kake-explain h2 {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #b82343;
  margin: 0 0 0.25em;
  border: none;
}
#kake-explain p {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1rem;
  line-height: 1.9;
  color: #333;
  margin: 0 0 0.9em;
}
#kake-explain p:last-child {
  margin-bottom: 0;
}

/* ── 発見後の語句解説 ─────────────────────────────────────── */
#kake-glossary {
  max-width: 560px;
  margin: 0 auto 1.5em;
  padding: 1.2em 1.4em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  background:#fff;
  border-radius: 6px;
  border-left: 4px solid #b82343;
}
#kake-glossary.show {
  opacity: 1;
  transform: translateY(0);
}
#kake-glossary h2 {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #b82343;
  margin: 0 0 0.7em;
  border: none;
}
.glossary-item {
  display: flex;
  align-items: baseline;
  gap: 0.7em;
  margin-bottom: 0.7em;
}
.glossary-item:last-child {
  margin-bottom: 0;
}
.glossary-badge {
  flex-shrink: 0;
  display: inline-block;
  min-width: 3.6em;
  text-align: center;
  background: #b82343;
  color: #fff;
  font-family: 'Noto Serif JP', serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.25em 0.8em;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.glossary-badge:has(rt) {
  padding-top: 0.6em;
}
.glossary-badge rt {
  color: #fff;
}

/* Safari（iOS/macOS）はルビと本文の間隔をChromiumより広く取ってしまうため、Safariのみ詰める */
@supports (-webkit-touch-callout: none) {
  #kake-explain rt,
  #kake-glossary rt {
    margin-top: -0.6em;
    margin-bottom: -0.6em;
  }
  .glossary-badge rt {
    margin-top: -0.3em;
    margin-bottom: -0.3em;
  }
}
.glossary-item p {
  margin: 0;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  line-height: 1.8;
  color: #333;
}
.glossary-item p a {
  word-break: break-all;
}

/* ── クリア後：もう一度する／詳しくはこちら ───────────────── */
#kg-btn-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 560px;
  margin: 0 auto 1.5em;
}
#kg-btn-wrap[hidden] {
  display: none;
}
#kg-retry-btn,
#kg-detail-btn {
  display: inline-block;
  width: fit-content;
  margin: 0;
  padding: 9px 20px;
  font-family: 'Noto Serif JP', serif;
  font-size: 0.95rem;
  font-weight: 700;
  background: #b82343;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.05em;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
#kg-retry-btn:hover, #kg-retry-btn:active,
#kg-detail-btn:hover, #kg-detail-btn:active {
  background: #8a1a30;
}
