/* めもりあわせ（memori-awase）だけのスタイル。クラスは ma- で始める。
   既存の --ink / --line / --drop / --r-* / --tap / .btn / .slate / .panel をそのまま使う。 */
.ma-game {
  --ma-band-lo: #FFFDF5;   /* ものさしの左（1側） */
  --ma-band-hi: #CFE6FF;   /* ものさしの右（100側）。tint #8EC5FF を薄めた色 */
  --ma-pin: #FFFDF5;       /* 印の地 */
  --ma-hit-bg: #DDF3E4;  --ma-hit-ink: #1F5A35;   /* ぴたり（緑。✓と文字つき） */
  --ma-miss-bg: #EEE6F4; --ma-miss-ink: #4E3A66;  /* ずれた（藤色。赤は使わない） */
  --ma-slot: #F1E4C9;      /* まだ置いていない枠 */
  flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px;
}

/* お題 */
.ma-theme { text-align: center; }
.ma-theme__label { font-size: 12px; font-weight: 800; color: var(--muted); }
.ma-theme__title { margin-top: 2px; font-weight: 800; font-size: clamp(22px, 6.4vw, 28px); line-height: 1.5;
  word-break: normal; overflow-wrap: break-word; line-break: strict; text-wrap: balance; }
.ma-theme--small .ma-theme__title { font-size: 17px; }

/* ものさし */
.ma-scale { background: var(--white); border: var(--line); border-radius: var(--r-l); box-shadow: var(--drop); padding: 16px 14px 14px; }
.ma-scale__track { position: relative; padding-top: var(--ma-lanes-h, 0px); }
.ma-scale__band { position: relative; height: 44px; border: var(--line); border-radius: 10px;
  background: linear-gradient(90deg, var(--ma-band-lo), var(--ma-band-hi)); overflow: hidden; }
/* 10刻みの目盛り線。50だけ長く・太く */
.ma-scale__band::before { content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), var(--ink) calc(10% - 2px) 10%);
  -webkit-mask: linear-gradient(#000 0 0) top / 100% 12px no-repeat; mask: linear-gradient(#000 0 0) top / 100% 12px no-repeat; opacity: .55; }
.ma-scale__band::after { content: ''; position: absolute; left: calc(50% - 1.5px); top: 0; width: 3px; height: 20px; background: var(--ink); }
.ma-scale__nums { display: flex; justify-content: space-between; margin-top: 4px; font-family: var(--display); font-size: 15px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ma-scale__ends { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
.ma-scale__end { max-width: 48%; font-size: 14px; font-weight: 800; line-height: 1.55; overflow-wrap: break-word; line-break: strict; text-wrap: balance; }
.ma-scale__end--high { text-align: right; }
.ma-scale__end small { display: block; font-size: 11px; font-weight: 800; color: var(--muted); }

/* 答え合わせで出す印。帯の中の縦線（正確な位置）＋帯の上の吹き出しピン（決めた順の番号）。
   ピンは下から積む：lane 0 が帯のすぐ上、近い値が重なるときだけ lane 1・2 へ。 */
.ma-scale__mark { position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: var(--ink); border-radius: 2px; }
.ma-pin { position: absolute; bottom: calc(44px + 10px + var(--ma-lane, 0) * 36px); width: 30px; height: 30px; margin-left: -15px;
  display: grid; place-items: center; background: var(--ma-pin); border: 2.5px solid var(--ink); border-radius: 9px;
  font-family: var(--display); font-size: 14px; line-height: 1; font-variant-numeric: tabular-nums;
  animation: ma-drop .3s ease-out both; }
.ma-pin::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 10px; height: 10px; margin-left: -5px;
  background: var(--ma-pin); border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); }
.ma-pin.is-latest { background: var(--accent); }
.ma-pin.is-latest::after { background: var(--accent); }
@keyframes ma-drop { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 話し合いのひとこと */
.ma-reminder { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: var(--r-s);
  background: #FFFDF5; font-size: 14px; font-weight: 800; line-height: 1.6; }
.ma-reminder svg { flex: none; width: 32px; height: 32px; }

/* 並び順の入力 */
.ma-head { font-size: 15px; font-weight: 800; text-align: center; }
.ma-axis { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 800; color: var(--muted); }
.ma-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ma-pick { position: relative; min-height: 56px; padding: 8px 10px 8px 12px; display: flex; flex-direction: column; justify-content: center;
  text-align: left; background: var(--white); border: var(--line); border-radius: var(--r-s); box-shadow: 3px 3px 0 var(--ink);
  font-size: 16px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; transition: transform .08s, box-shadow .08s, background .12s; }
.ma-pick:active:not([aria-disabled="true"]) { transform: translate(3px, 3px); box-shadow: none; }
.ma-pick__tag { font-size: 12px; color: var(--muted); }
.ma-pick[aria-disabled="true"] { background: var(--ma-slot); box-shadow: none; transform: translate(3px, 3px); color: var(--muted); }
.ma-pick__no { position: absolute; top: -10px; right: -8px; min-width: 30px; height: 30px; padding: 0 6px; display: grid; place-items: center;
  background: var(--ink); color: var(--white); border-radius: 999px; font-family: var(--display); font-size: 15px; line-height: 1; }
.ma-order { background: var(--white); border: 2px solid var(--ink); border-radius: var(--r-s); padding: 10px 12px; }
.ma-order__label { font-size: 12px; font-weight: 800; color: var(--muted); }
.ma-order__list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ma-order__item { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 4px; border: 2px solid var(--ink); border-radius: 999px;
  font-size: 13px; font-weight: 800; line-height: 1.5; max-width: 100%; overflow-wrap: anywhere; }
.ma-order__item b { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--ink); color: var(--white); font-size: 12px; }
.ma-order__item--empty { border-style: dashed; color: var(--muted); background: var(--ma-slot); }
.ma-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ma-tools .btn { min-height: 48px; padding: 10px 8px; font-size: 15px; }

/* 答え合わせ */
.ma-rows { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ma-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto 52px; align-items: center; gap: 8px; min-height: 52px; padding: 6px 10px;
  background: var(--white); border: 2px solid var(--ink); border-radius: var(--r-s); }
.ma-row__no { display: grid; place-items: center; width: 30px; height: 30px; border: 2.5px solid var(--ink); border-radius: 9px; background: var(--ma-pin);
  font-family: var(--display); font-size: 14px; line-height: 1; }
.ma-row__name { font-size: 15px; font-weight: 800; line-height: 1.4; overflow-wrap: anywhere; }
.ma-row__value { text-align: right; font-family: var(--display); font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.ma-row.is-hidden .ma-row__value { color: var(--muted); }
.ma-row.is-latest { background: #FFFBEA; box-shadow: inset 0 0 0 2px var(--accent); }
.ma-row.is-latest .ma-row__no { background: var(--accent); }
.ma-mark { display: inline-flex; align-items: center; gap: 3px; min-height: 28px; padding: 2px 9px; border: 2px solid currentColor; border-radius: 999px;
  font-size: 12.5px; font-weight: 800; white-space: nowrap; animation: ma-fade .3s ease-out both; }
.ma-mark--hit { background: var(--ma-hit-bg); color: var(--ma-hit-ink); }
.ma-mark--miss { background: var(--ma-miss-bg); color: var(--ma-miss-ink); border-style: dashed; }
.ma-mark svg { width: 14px; height: 14px; }
@keyframes ma-fade { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }

.ma-dock { position: sticky; bottom: 0; z-index: 2; margin: 0 -20px; padding: 12px 20px max(14px, env(safe-area-inset-bottom));
  background: var(--page-bg); border-top: 3px dashed var(--ink); display: flex; flex-direction: column; gap: 10px; }
.ma-score { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px;
  background: var(--white); border: var(--line); border-radius: var(--r-m); box-shadow: var(--drop); }
.ma-score.is-all { background: var(--accent); }
.ma-score__label { font-size: 13px; font-weight: 800; }
.ma-score__num { font-family: var(--display); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ma-score__dots { display: flex; gap: 4px; margin-top: 4px; }
.ma-score__dots i { width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 50%; }
.ma-score__dots i.is-on { background: var(--ma-hit-ink); }
.ma-score__note { font-size: 13px; font-weight: 800; }

/* 答え合わせ中は、ものさしを上に貼りつけて、下の行を開いても印が見えるようにする。
   画面上部に固定表示の道具ボタン（高さ46px、z-index 30）があるので、その下に貼りつけて隠れないようにする */
.ma-scale--sticky { position: sticky; top: max(68px, calc(env(safe-area-inset-top) + 54px)); z-index: 2; padding: 10px 12px; box-shadow: 0 4px 0 var(--ink); }
body:has(#banner-top:not([hidden])) .ma-scale--sticky { top: max(118px, calc(env(safe-area-inset-top) + 104px)); }
.ma-scale--sticky .ma-scale__end { font-size: 12px; line-height: 1.45; }
.ma-scale--sticky .ma-scale__nums { font-size: 13px; }

.ma-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 350px) {
  .ma-row { grid-template-columns: 28px minmax(0, 1fr) auto 44px; gap: 6px; padding: 6px 8px; }
  .ma-row__value { font-size: 20px; }
  .ma-mark { padding: 2px 6px; font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .ma-pin, .ma-mark { animation: none; }
  .ma-pick { transition: none; }
}
