@charset "UTF-8";
/* 対戦ゲームの「振り返り」（js/karuta-analysis.js が開く「今回の札一覧」の画面）。
   表の見た目は css/list.css と list.html・list_en.html の <style> を写し、.ka-overlay の中だけに効くようにしたもの。
   list.css の表の見た目を変えたら、こちらも合わせること。 */

.ka-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: rgba(20, 14, 8, 0.6);
  -webkit-user-select: text;
  user-select: text;
}

.ka-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;
  max-height: 100%;
  box-sizing: border-box;
  background: #382f21;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  color: #fff;
  /* 書体は list.html と同じ（style.css の body と同じ指定）。英語は下の .ka-overlay[lang=en] */
  font-family: "noto-sans-pro", sans-serif;
  font-weight: normal;
  font-size: 16px;
  line-height: 1.8;
  text-align: left;
  overflow: hidden;
}

.ka-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #382f21;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.ka-title {
  font-size: 1.15rem;
  font-weight: bold;
  letter-spacing: 0.1em;
}

.ka-close {
  padding: 4px 14px;
  border: 1px solid #b82343;
  border-radius: 999px;
  background: #b82343;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.6;
  cursor: pointer;
}

.ka-close:hover {
  background: #9c1d38;
}

.ka-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 12px 16px 20px;
  background: #fffdf8;
  color: #333;
}

.ka-msg {
  margin: 1.5em 0;
  text-align: center;
  color: #333;
}

.ka-hint {
  margin: 0 0 0.8em;
  font-size: 0.85rem;
  color: #333;
}

.ka-group {
  margin: 1.2em 0 0;
}

.ka-group-title {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  margin: 0 0 6px;
  padding: 2px 0 2px 10px;
  border-left: 5px solid #8d6e63;
  font-size: 1.05rem;
  font-weight: bold;
  color: #333;
}

.ka-group[data-kind=took] .ka-group-title {
  border-left-color: #2e7d32;
}

.ka-group[data-kind=lost] .ka-group-title {
  border-left-color: #b82343;
}

.ka-group[data-kind=left] .ka-group-title {
  border-left-color: #c2b99a;
}

.ka-group[data-kind=empty] .ka-group-title {
  border-left-color: #607d8b;
}

.ka-count {
  font-size: 0.85rem;
  font-weight: normal;
  color: #333;
}

.ka-none {
  margin: 0;
  padding: 4px 0 0 15px;
  font-size: 0.9rem;
  color: #333;
}

/* ロボット対戦の強さ（やさしい・ふつう・つよい・鬼）のバッジ。対戦中の画面・結果画面・振り返りの見出しで共用
   （js/karuta-analysis.js の modeBadge が作る） */
.karuta-mode {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  /* 紫のロボット（👾）が見えやすいよう地は明るくし、強さの色は枠と文字に付ける */
  background: #fffdf8;
  border: 1.5px solid currentColor;
  color: #1e50a2;
  font-size: 11px;
  font-weight: bold;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-shadow: none;
  white-space: nowrap;
  vertical-align: middle;
}

.karuta-mode[data-level=easy] {
  color: #2e7d32;
}

.karuta-mode[data-level=hard] {
  color: #b82343;
}

/* 鬼：炎の色（下が金色、上へ橙・紅）がゆらめく。選択画面の「鬼」ボタン（karuta-taisen.html の <style>）と同じ色。
   紫のロボットは濃い赤の上では見えにくいので、明るい丸の上に載せる */
.karuta-mode[data-level=master] {
  padding-left: 2px;
  background: linear-gradient(to top, #f5a524 0%, #ee6a1a 22%, #d8341a 50%, #b3161b 75%, #d8341a 100%);
  background-size: 100% 180%;
  background-position: 0 100%;
  border-color: #a3141a;
  color: #fff;
  text-shadow: 0 0 2px #7a0c10, 0 1px 2px #7a0c10;
  animation: karuta-mode-fire 1.4s ease-in-out infinite alternate;
}

.karuta-mode[data-level=master] .karuta-mode-icon {
  display: inline-block;
  width: 1.4em;
  border-radius: 50%;
  background: #fffdf8;
  text-align: center;
  text-indent: 0;
  letter-spacing: 0;
  text-shadow: none;
}

@keyframes karuta-mode-fire {
  0% {
    background-position: 0 100%;
    box-shadow: 0 0 4px rgba(238, 106, 26, 0.6);
  }
  35% {
    background-position: 0 72%;
    box-shadow: 0 0 9px rgba(238, 106, 26, 0.9);
  }
  60% {
    background-position: 0 88%;
    box-shadow: 0 0 5px rgba(238, 106, 26, 0.65);
  }
  100% {
    background-position: 0 60%;
    box-shadow: 0 0 10px rgba(238, 106, 26, 0.95);
  }
}

@media (prefers-reduced-motion: reduce) {
  .karuta-mode[data-level=master] {
    animation: none;
  }
}

.ka-title .karuta-mode {
  margin-left: 0.8em;
  font-size: 0.8rem;
}

/* .ka-list：だんごゲーム（kaminoku／shimonoku／jokotoba-dango）のクリア後の「今回の歌」一覧も、
   同じ表の見た目を使う（js/*-dango.js の renderResults が <div class="ka-list"><table> を作る） */
/* ===== 表（css/list.css の table と同じ） =====
   見出しの帯（.ka-head）は暗い色、本文（.ka-body）は明るい色（#fffdf8）。表の中の文字は濃い色 */
.ka-overlay table,
.ka-list table {
  color: #333;
  border-collapse: collapse;
  border: 1px solid #ddd6be;
  font-size: 1.1rem;
  width: 100%;
  margin: 0;
}

@media (max-width: 760px) {
  .ka-overlay table,
  .ka-list table {
    font-size: 1rem;
  }
}

.ka-overlay table td,
.ka-list table td {
  border: 1px solid #ddd6be;
}

.ka-overlay table td:nth-child(1),
.ka-list table td:nth-child(1) {
  text-align: center;
  width: 56px;
  min-width: 48px;
  padding: 10px 6px 10px;
  vertical-align: middle;
  cursor: pointer;
  /* 番号の列は五色百人一首の色（js/list-rows.js が style で付ける）を使わず、1色にそろえる */
  background-color: #f0e8d8 !important;
}

.ka-overlay table td:nth-child(1) .num-badge,
.ka-list table td:nth-child(1) .num-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ede6cc;
  color: #0047ab;
  font-weight: bold;
  font-size: 0.85rem;
  border: 1px solid #c2b99a;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}

.ka-overlay table td:nth-child(1) .num-badge::after,
.ka-list table td:nth-child(1) .num-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
  background: rgba(30, 20, 10, 0.8);
  color: #fff;
  font-size: 0.68rem;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
}

.ka-overlay table td:nth-child(1):hover,
.ka-list table td:nth-child(1):hover {
  position: relative;
  z-index: 100;
}

.ka-overlay table td:nth-child(1) .num-badge:hover,
.ka-list table td:nth-child(1) .num-badge:hover {
  background: #b82343;
  color: #fff;
  border-color: #b82343;
  transform: scale(1.12);
}

.ka-overlay table td:nth-child(1) .num-badge:hover::after,
.ka-list table td:nth-child(1) .num-badge:hover::after {
  opacity: 1;
}

@media (max-width: 960px) {
  .ka-overlay table td:nth-child(1),
  .ka-list table td:nth-child(1) {
    width: 44px;
  }
}

.ka-overlay table td:nth-child(2),
.ka-list table td:nth-child(2) {
  padding: 1.5% 1.5% 0.75%;
  width: 90%;
  border-right: none;
}

@media (max-width: 960px) {
  .ka-overlay table td:nth-child(2),
  .ka-list table td:nth-child(2) {
    padding: 8% 1.5% 2%;
  }
}

.ka-overlay table td:nth-child(2) rt,
.ka-list table td:nth-child(2) rt {
  font-size: 0.5em;
  letter-spacing: 0;
}

.ka-overlay table th,
.ka-list table th {
  border: 1px solid #ddd6be;
  background: #ede6cc;
  color: #333;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 6px 8px;
  text-align: center;
  white-space: nowrap;
}

/* 上の句と下の句の間の改行：画面幅960px未満だけ改行し、それ以上では1行で表示 */
.ka-overlay .waka-br,
.ka-list .waka-br {
  display: none;
}

@media (max-width: 959px) {
  .ka-overlay .waka-br,
  .ka-list .waka-br {
    display: inline;
  }
}

.ka-overlay .waka-game-links,
.ka-list .waka-game-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-top: 0.6em;
}

/* 歌人名（style.css の .small と同じ見た目。3D版のページには style.css が無いのでここで決める） */
.ka-overlay .waka-game-links .small,
.ka-list .waka-game-links .small {
  display: block;
  text-align: right;
  padding-top: 0;
  margin-top: 0;
  margin-left: auto;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  font-size: 0.8em;
}

.ka-overlay .kimariji-label,
.ka-list .kimariji-label {
  display: none;
  font-size: 0.85em;
  color: #b82343;
  white-space: nowrap;
}

.ka-overlay td.is-open .kimariji-label,
.ka-list td.is-open .kimariji-label {
  display: inline;
}

/* 現代語訳（list.html・list_en.html の <style> と同じ） */
.ka-overlay .modern-text,
.ka-list .modern-text {
  display: block;
  font-size: 0.85em;
  color: #7a6655;
  margin-top: 5px;
  line-height: 1.7;
  border-top: 1px solid #e0d8c8;
  padding-top: 4px;
}

.ka-overlay .modern-toggle,
.ka-list .modern-toggle {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.75em;
  color: #b82343;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.ka-overlay td[data-has-modern]:hover,
.ka-list td[data-has-modern]:hover {
  background-color: #f0e8d8 !important;
}

/* 英語版の行（list_en.html の <style> と同じ） */
.ka-overlay .romaji-text,
.ka-list .romaji-text {
  display: block;
  font-size: 0.82em;
  color: #666;
  margin-top: 2px;
  font-style: italic;
}

.ka-overlay .kanji-text,
.ka-list .kanji-text {
  font-weight: normal;
}

/* 英語版の書体（list_en.html と同じ。style.css の html[lang=en] の指定と同じもの） */
.ka-overlay[lang=en] .ka-panel,
.ka-overlay[lang=en] td,
.ka-overlay[lang=en] th,
.ka-overlay[lang=en] span,
.ka-overlay[lang=en] a,
.ka-overlay[lang=en] p,
.ka-overlay[lang=en] div,
.ka-overlay[lang=en] button {
  font-family: "Noto Sans", "Noto Serif JP", sans-serif !important;
}

/* ===== 「振り返り」ボタンの枠を回る光（js/karuta-analysis.js の decorate が SVG を重ねる） =====
   枠と同じ形の線（pathLength=100）のうち、明るい細い線（head）だけを描き、
   stroke-dashoffset をずらし続けて枠の上を回らせる */
.ka-glow-btn {
  position: relative;
  overflow: visible;
}

.ka-glow {
  position: absolute;
  left: -3px;
  top: -3px;
  overflow: visible;
  pointer-events: none;
}

.ka-glow rect {
  fill: none;
  stroke-linecap: round;
  animation: ka-glow-run 2.6s linear infinite;
}

.ka-glow-head {
  stroke: #fff6d0;
  stroke-width: 2.2;
  stroke-dasharray: 9 91;
  filter: drop-shadow(0 0 2px #ffd77a) drop-shadow(0 0 6px #ffb347);
}

@keyframes ka-glow-run {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -100;
  }
}

/* 動きを減らす設定の端末では回さず、枠をうっすら光らせるだけにする */
@media (prefers-reduced-motion: reduce) {
  .ka-glow rect {
    animation: none;
  }
  .ka-glow-head {
    stroke: rgba(255, 214, 120, 0.55);
    stroke-dasharray: none;
    filter: none;
  }
}
