/* ============================================================
   決まり字弓矢（kimariji-yumiya.html）だけの見た目。
   スタート画面・ゲーム画面・札などの土台は css/dango-jokotoba.css を使う。
   プレイヤー（you）は左下・紫系、ロボット（cpu）は右下・青系。
   ============================================================ */

/* 取った札の数「あなた 3 対 2 ロボット」（お題の下） */
#score-line .vs-name {
  font-size: 11px;
  color: #a8577a;
  letter-spacing: 0.06em;
}

#score-line .vs-num {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

#taken-you { color: #b03a6b; }
#taken-cpu { color: #2f5f9e; }

/* 得点の両端の絵文字（あなた：パンダ、ロボット：ロボット） */
#score-line .vs-avatar {
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0;
}

#score-line .vs-sep {
  font-size: 11px;
  color: #999;
}

/* スマホの操作説明は、バッジ（「タップ」「下にスワイプ」など）のすぐあとで改行して読みやすく */
@media (max-width: 600px) {
  .how-to-box .how-touch .how-line .key {
    display: table;
    margin: 0 0 2px;
  }

  .how-to-box .how-touch .how-line {
    margin-bottom: 8px;
  }
}

/* 開始画面の「ねらい方（傾き／タッチ）」は、スマホ・タブレットだけに出す */

/* 開始画面：「はじめる」の上のひとこと説明 */
.start-lead {
  margin: 14px 0 10px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.6;
  color: #7a2645;
}

/* 詳しいルールと操作の折りたたみ（「はじめる」の下） */
.rules-details {
  margin-top: 22px;
  border: 1px solid #e6cfd6;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
}

.rules-details > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 0.95rem;
  color: #b82343;
  user-select: none;
}

.rules-details > summary::-webkit-details-marker {
  display: none;
}

.rules-details > summary::after {
  content: "▼";
  font-size: 0.7em;
  color: #c9a0ad;
  transition: transform 0.2s;
}

.rules-details[open] > summary::after {
  transform: rotate(180deg);
}

.rules-details > .rules-list,
.rules-details > .how-to-box {
  margin: 0 14px 14px;
}

/* 早送り中の表示（得点の下） */
#fast-badge {
  display: inline-block;
  margin-top: 6px;
}

/* ============================================================
   弓（左下があなた、右下がロボット。js が .bow をねらいの向きに回す）
   ============================================================ */
.bow-area {
  position: absolute;
  bottom: 56px; /* 下に名前と命を置き、横に向けても弓の端が画面の下で切れない高さ */
  width: 120px;
  height: 90px;
  margin-left: -60px;
  z-index: 30;
  pointer-events: none;
}

.bow-area-you { left: 22%; }
.bow-area-cpu { left: 78%; }

@media (min-width: 1001px) {
  .bow-area-you { left: 30%; }
  .bow-area-cpu { left: 70%; }
}

.bow {
  position: absolute;
  inset: 0;
  transform-origin: 60px 58px; /* 弓の握り（.bow-pivot）を中心に回す */
}

.bow-pivot {
  position: absolute;
  left: 59px;
  top: 57px;
  width: 2px;
  height: 2px;
}

.bow-body {
  position: absolute;
  inset: 0;
  width: 120px;
  height: 90px;
  overflow: visible;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.bow-body .bow-limb {
  fill: none;
  stroke: #7a3b1d;
  stroke-width: 6;
  stroke-linecap: round;
}

.bow-area-cpu .bow-body .bow-limb {
  stroke: #3a3f55;
}

.bow-body .bow-grip { fill: #c0396b; }
.bow-area-cpu .bow-body .bow-grip { fill: #2f5f9e; }

.bow-body .fletch { fill: #c0396b; }
.bow-area-cpu .bow-body .fletch { fill: #2f5f9e; }

.bow-body .bow-string {
  fill: none;
  stroke: #5b4636;
  stroke-width: 1.5;
}

/* 矢をつがえて引いているとき／射たあと（次の矢を射られるまで）で、弦と矢を切り替える */
.bow .string-drawn,
.bow .nocked-arrow {
  display: none;
}

.bow.drawn .string-drawn,
.bow.drawn .nocked-arrow {
  display: inline;
}

.bow.drawn .string-rest {
  display: none;
}

/* 名前と命（弓の下・上） */
.bow-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -28px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #b03a6b;
  white-space: nowrap;
}

.bow-area-cpu .bow-name { color: #2f5f9e; }

/* 早送りを押している側は、名前の横に ▼▼ */
.bow-area.pressing-fast .bow-name::after {
  content: " ▼▼";
  color: #5a7fb8;
}

.lives {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -50px;
  text-align: center;
  white-space: nowrap;
  line-height: 1;
}

/* 命は絵文字（あなた：パンダ、ロボット：ロボット）を残りの数だけ並べる。失うと js が飛ばして消す */
.lives .life {
  display: inline-block;
  margin: 0 1px;
  font-size: 18px;
  line-height: 1;
}

/* ねらいの補助線（プレイヤーだけ。やさしい：長い、ふつう：短い、つよい：なし。長さは js が決める） */
#aim-guide {
  position: absolute;
  left: 59px;
  bottom: 32px; /* 握り（上から58px）の位置から上へ伸ばす */
  width: 0;
  border-left: 2px dashed rgba(192, 57, 107, 0.45);
}

/* ============================================================
   飛んでいく矢（先端が要素の上の中央。js が向きと位置を決める）
   ============================================================ */
.arrow {
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 64px;
  z-index: 25;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 64'%3E%3Cpolygon points='6,0 1,12 11,12' fill='%23444'/%3E%3Crect x='5' y='11' width='2' height='47' fill='%238a5a2b'/%3E%3Cpolygon points='6,46 0.5,62 6,57' fill='%23c0396b'/%3E%3Cpolygon points='6,46 11.5,62 6,57' fill='%23c0396b'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

/* ロボットの矢は羽根が青 */
.arrow.arrow-cpu {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 64'%3E%3Cpolygon points='6,0 1,12 11,12' fill='%23444'/%3E%3Crect x='5' y='11' width='2' height='47' fill='%23555b70'/%3E%3Cpolygon points='6,46 0.5,62 6,57' fill='%232f5f9e'/%3E%3Cpolygon points='6,46 11.5,62 6,57' fill='%232f5f9e'/%3E%3C/svg%3E");
}

@media (min-width: 1001px) {
  .arrow {
    width: 14px;
    height: 76px;
  }
}

/* ロボットが正しい札を射抜いたとき */
.card.cpu-flash {
  border-color: #3d78c9;
  box-shadow: 3px 5px 14px rgba(0, 0, 0, 0.3), 0 0 18px rgba(61, 120, 201, 0.7);
}

/* 「取った！」「ロボットが取った」「1機失った」 */
/* 画面の幅に合わせて大きく（スマホ 約26px〜PC 36px） */
.hit-pop {
  font-size: clamp(24px, 6.6vw, 36px);
  letter-spacing: 0.04em;
  color: #c0396b;
}

.hit-pop.hit-pop-cpu {
  color: #2f5f9e;
}

.hit-pop.bad {
  color: #7a7a7a;
  font-size: clamp(20px, 5.4vw, 30px);
}

/* ============================================================
   射抜いた歌の全文：右の列に決まり字。ロボットが取った札は枠を青に
   ============================================================ */
#poem-reveal-text .reveal-kimariji {
  color: #c0396b;
  font-size: 0.85em;
}

#poem-reveal-paper.by-cpu {
  border-color: #8fb0dc;
}

#poem-reveal-paper.by-cpu .reveal-kimariji {
  color: #2f5f9e;
}

/* ============================================================
   決着：勝てば喜ぶ猫、負ければ悲しむ猫と決着の言葉
   （karuta-taisen.html の #medetashi-overlay / #oshii-overlay と同じ見た目・動き。js の showEndCat）
   ============================================================ */
.end-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 9999;
  animation: end-overlay-fade 4s ease forwards;
}

.end-overlay img {
  display: block;
  width: clamp(120px, 40vw, 200px);
  height: auto;
}

.end-overlay span {
  font-family: "Noto Serif JP", serif;
  font-weight: 700;
  font-size: clamp(60px, 15vw, 80px);
  color: #c0392b;
  text-shadow:
    0 0 2px #fff, 0 0 4px #fff,
    3px 3px 0 #fff, -3px 3px 0 #fff, 3px -3px 0 #fff, -3px -3px 0 #fff,
    3px 0 0 #fff, -3px 0 0 #fff, 0 3px 0 #fff, 0 -3px 0 #fff,
    4px 0 0 #fff, -4px 0 0 #fff, 0 4px 0 #fff, 0 -4px 0 #fff;
  letter-spacing: 0.15em;
}

.end-overlay.end-lose span { color: #2c5f8a; }

@keyframes end-overlay-fade {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* スマホ（縦向き）の日本語では、猫の右に決着の言葉を縦書きで並べる（karuta-taisen.html と同じ）。英語は横書きのまま */
@media (max-width: 767px) and (orientation: portrait) {
  html:not([lang="en"]) .end-overlay {
    flex-direction: row;
    gap: 6px;
  }

  html:not([lang="en"]) .end-overlay span {
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 0.08em;
  }
}

/* 縦書きの「！」を1文字分の真ん中に置く（js の setOutcomeText） */
.v-bang {
  text-combine-upright: all;
}

#clear-msg.lose {
  color: #4a5a78;
  text-shadow: 0 0 20px rgba(200, 215, 240, 1), 2px 2px 6px rgba(0, 0, 0, 0.25);
}

#result-box .result-outcome.win { color: #c0396b; }
#result-box .result-outcome.lose { color: #4a5a78; }

#result-box .result-subtitle {
  margin: 4px 0 4px;
  padding: 0;
  border: none;
  background: none;
  font-size: 1rem;
  color: #7a2645;
}

/* 一覧の歌番号の下に、取った方 */
.ka-list .taken-by {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.ka-list .taken-by-you { color: #b03a6b; }
.ka-list .taken-by-cpu { color: #2f5f9e; }
