/* アニメ名言かるた：畳の緑 × 札の生成り × 朱 × 藍 */
:root {
  --bg: #f4efe3;
  --paper: #fffdf7;
  --ink: #22304a;
  --sub: #66707e;
  --line: #e2d9c4;
  --tatami: #cfc88f;
  --tatami-d: #b3ab6c;
  --fuda: #fffaf0;
  --fuda-edge: #2f5d3a;
  --shu: #c8432f;
  --shu-d: #a53322;
  --ai: #2c4a7a;
  --gold: #c9971a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  line-height: 1.8; font-size: 16px;
}
a { color: var(--ai); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }
.center { text-align: center; }
.hint { font-size: 13px; color: var(--sub); }
.mincho { font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; }

/* ===== ヘッダー ===== */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .04em; }
.logo img { width: 28px; height: 28px; }
.nav ul { display: flex; gap: 16px; list-style: none; margin: 0; padding: 0; font-size: 14px; }
.nav ul a { color: var(--sub); text-decoration: none; }
.nav ul a:hover { color: var(--shu); }

.hero-head { text-align: center; padding: 14px 0 4px; }
.hero-head .sub { font-size: 12px; letter-spacing: .3em; color: var(--shu); font-weight: 700; }
.hero-head h1 { font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif; font-size: clamp(32px, 8vw, 48px); margin: 2px 0 4px; letter-spacing: .08em; line-height: 1.3; }
.hero-head p { margin: 0; color: var(--sub); }
.hero-demo { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px auto 0; }
.demo-yomi { font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 22px; font-weight: 700; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 6px 14px; }
.demo-arrow { color: var(--shu); font-weight: 800; font-size: 22px; }

/* ===== カード・ボタン ===== */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; margin: 18px 0; }
.card h2 { font-size: 18px; margin: 0 0 10px; line-height: 1.5; }
.card h2 + .seg + h2 { margin-top: 18px; }
.card h3 { font-size: 17px; margin: 22px 0 8px; }
.card p { margin: 0 0 12px; }
.card ol { padding-left: 1.4em; margin: 0 0 8px; }
.card li { margin-bottom: 6px; }

.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.seg[data-seg="count"] { grid-template-columns: repeat(3, 1fr); }
.seg button {
  font: inherit; font-weight: 700; font-size: 16px; line-height: 1.3; padding: 10px 6px; border-radius: 10px;
  border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.seg button small { display: block; font-size: 12px; font-weight: 500; color: var(--sub); }
.seg button[aria-pressed="true"] { border-color: var(--shu); background: #fdeee9; color: var(--shu-d); }
.seg button[aria-pressed="true"] small { color: var(--shu-d); }
.check { display: flex; align-items: center; gap: 8px; margin: 18px 0 4px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--shu); }

.btn {
  display: block; width: 100%; margin-top: 16px; font: inherit; font-size: 18px; font-weight: 800; letter-spacing: .1em;
  padding: 13px; border: none; border-radius: 999px; background: var(--shu); color: #fff; cursor: pointer;
  box-shadow: 0 3px 0 var(--shu-d); text-decoration: none; text-align: center;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shu-d); }
.btn.ghost { background: #fff; color: var(--shu-d); border: 2px solid var(--shu); box-shadow: none; }
.btn.small { display: inline-block; width: auto; font-size: 15px; padding: 7px 22px; margin-top: 8px; letter-spacing: .04em; }

/* ===== 対戦画面 ===== */
#game { margin-top: 12px; scroll-margin-top: 8px; }
.sticky { position: sticky; top: 0; z-index: 10; background: var(--bg); padding-top: 6px; }
.status { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.status .side b { font-size: 22px; }
.status .me { color: var(--shu-d); }
.status .them { text-align: right; color: var(--ai); }
.status .mid { text-align: center; color: var(--sub); font-size: 13px; font-variant-numeric: tabular-nums; }
.status .them[hidden] { display: block; visibility: hidden; }

.yomifuda {
  position: relative; margin: 8px 0 10px; min-height: 92px; padding: 14px 16px 12px; border-radius: 12px;
  background: var(--paper); border: 3px double var(--shu); display: flex; align-items: center;
}
.yomi-no { position: absolute; top: -11px; left: 12px; background: var(--shu); color: #fff; font-size: 12px; font-weight: 700; padding: 0 10px; border-radius: 999px; }
.yomi { font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif; font-size: clamp(22px, 6vw, 30px); font-weight: 700; line-height: 1.5; letter-spacing: .04em; }
.yomi span { animation: ink .18s ease-out; }
@keyframes ink { from { opacity: 0; } to { opacity: 1; } }

.flash { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 20; padding: 10px 22px; border-radius: 999px; font-weight: 800; color: #fff; background: var(--ai); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.flash.bad { background: #8a1f1f; }

/* 取り札：畳の上に並べる。縦書き */
.board {
  display: grid; gap: 8px; padding: 10px; border-radius: 12px;
  background: repeating-linear-gradient(90deg, var(--tatami) 0 3px, #d6cf98 3px 6px); border: 6px solid #6b5b3a;
  grid-template-columns: repeat(4, 1fr);
}
.board.n12 { grid-template-columns: repeat(4, 1fr); }
@media (min-width: 620px) { .board.n12 { grid-template-columns: repeat(6, 1fr); } .board.n16 { grid-template-columns: repeat(8, 1fr); } }
.fuda {
  position: relative; aspect-ratio: 52 / 73; padding: 6px 3px; border-radius: 6px; cursor: pointer;
  background: var(--fuda); border: 3px solid var(--fuda-edge); box-shadow: 0 2px 0 rgba(0,0,0,.25);
  font: inherit; color: var(--ink); display: flex; align-items: center; justify-content: center; overflow: hidden;
  transition: transform .25s, opacity .25s;
}
.fuda span {
  writing-mode: vertical-rl; text-orientation: mixed; font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif;
  font-weight: 700; font-size: clamp(12px, 3.4vw, 17px); line-height: 1.35; letter-spacing: .02em; max-height: 100%;
}
.fuda .tcy { text-combine-upright: all; -webkit-text-combine: horizontal; }
.fuda:hover { transform: translateY(-2px); }
.fuda.shake { animation: shake .35s; border-color: #8a1f1f; }
@keyframes shake { 25% { transform: translateX(-5px) rotate(-3deg); } 75% { transform: translateX(5px) rotate(3deg); } }
.fuda.gone { pointer-events: none; opacity: 0; }
.fuda.to-me { transform: translateY(40px) rotate(-12deg) scale(.8); }
.fuda.to-them { transform: translateY(-40px) rotate(12deg) scale(.8); }
.fuda.demo { width: 84px; cursor: default; }
.fuda.demo span { font-size: 15px; }

/* とった札の答え：画面の下に出す（札が多いと盤の下が画面の外になるため） */
.reveal {
  position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 15; width: min(728px, calc(100% - 20px));
  background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 12px 16px; text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,.25); animation: up .2s ease-out;
}
@keyframes up { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.reveal p { margin: 0 0 4px; }
.who-took { display: inline-block; font-size: 13px; font-weight: 800; padding: 2px 14px; border-radius: 999px; color: #fff; background: var(--shu); margin-bottom: 6px; }
.who-took.them { background: var(--ai); }
.reveal .full { font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 20px; font-weight: 700; line-height: 1.6; }
.reveal .src { color: var(--sub); font-size: 14px; }
.reveal .km { font-size: 14px; }
.reveal .km b { color: var(--shu-d); font-size: 17px; }
.reveal .km small { display: block; color: var(--sub); font-size: 12px; }

/* ===== 結果 ===== */
.result { text-align: center; }
.result .rank { display: inline-block; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 30px; font-weight: 800; color: #fff; background: var(--shu); padding: 2px 26px; border-radius: 8px; letter-spacing: .15em; }
.result .big { font-size: 54px; font-weight: 900; line-height: 1.3; margin-top: 6px; font-variant-numeric: tabular-nums; }
.result .big small { font-size: 22px; margin-left: 2px; }
.res-line { color: var(--sub); }
.res-line .new { color: var(--shu-d); }
.share { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0 4px; }
.sbtn { font: inherit; font-size: 14px; font-weight: 700; padding: 8px 16px; border-radius: 999px; text-decoration: none; color: #fff; border: none; cursor: pointer; }
.sbtn.x { background: #111; }
.sbtn.line { background: #06c755; }
.sbtn.copy { background: var(--ai); }
.sbtn.threads { background: #333; }
.sbtn.bsky { background: #1185fe; }
.sbtn.fb { background: #1877f2; }
.sbtn.native { background: var(--shu); }
.res-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.res-btns .btn { font-size: 15px; letter-spacing: .02em; }
.res-list { text-align: left; padding-left: 1.6em; font-size: 15px; }
.res-list li { margin-bottom: 8px; }
.res-list small { display: block; color: var(--sub); font-size: 12px; }
.res-list .mark { display: inline-block; font-size: 11px; font-weight: 800; color: #fff; border-radius: 4px; padding: 0 6px; margin-right: 6px; vertical-align: 2px; }
.res-list .me .mark { background: var(--shu); }
.res-list .them .mark { background: var(--ai); }

/* ===== 一覧ページ ===== */
.qtable { width: 100%; border-collapse: collapse; font-size: 15px; }
.qtable th, .qtable td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.qtable th { font-size: 13px; color: var(--sub); }
.qtable .q { font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-weight: 700; }
.qtable .q .shimo { color: var(--shu-d); }
.qtable small { color: var(--sub); }
table:not(.qtable) { width: 100%; border-collapse: collapse; }
table:not(.qtable) th, table:not(.qtable) td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; font-size: 15px; }
table:not(.qtable) th { width: 30%; color: var(--sub); }

/* ===== 広告・フッター ===== */
.ad-slot { margin: 18px 0; }
.ad-label { font-size: 11px; color: var(--sub); text-align: center; }
.ad-dummy { border: 2px dashed var(--line); border-radius: 10px; padding: 26px; text-align: center; color: var(--sub); font-size: 13px; }
footer { margin-top: 30px; font-size: 13px; color: var(--sub); text-align: center; }
footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-bottom: 10px; }
footer a { color: var(--sub); }
.bignum { font-size: 64px; font-weight: 900; color: var(--shu); }
.shimo-ex, .qtable .q .shimo { color: var(--shu-d); }
