/* モグラたたけたけの見た目。画面は縦長（941:1672）の舞台に収め、文字は舞台の幅に合わせて大きさが変わる（cqw） */
:root {
  --ink: #1b1308;
  --paper: #fffaf0;
  --brown: #8a4b1f;
  --green: #8be02d;
  --yellow: #ffd83d;
  --red: #ef4444;
  --sky: #5ec8fa;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: #2d5a1b;
  color: var(--ink);
  font-family: 'Zen Maru Gothic', system-ui, -apple-system, 'Hiragino Sans', sans-serif;
  /* 連打で文字が選ばれたり、画面が拡大されたりしないようにする */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
body {
  display: flex;
  align-items: center;
  justify-content: center;
}
[hidden] {
  display: none !important;
}
.stage {
  position: relative;
  container-type: size;
  aspect-ratio: 941 / 1672;
  height: min(100dvh, calc(100vw * 1672 / 941));
  overflow: hidden;
  background: var(--sky);
}
#field {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* 点数と命 */
/* 叩いた数と命は、画面の上の真ん中に大きく */
.hud {
  position: absolute;
  top: 5cqw;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2cqw;
  pointer-events: none;
}
.hud-score {
  font-size: 19cqw;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 1.2cqw var(--ink);
  paint-order: stroke fill;
}
.hud-score small {
  font-size: 8cqw;
  margin-left: 1cqw;
}
/* 3桁の時は少し小さく（右上の太陽にかからないように） */
.hud-score.wide {
  font-size: 15.5cqw;
}
.hud-score.wide small {
  font-size: 7cqw;
}
.hud-lives {
  display: flex;
  gap: 2.5cqw;
  font-size: 12cqw;
  line-height: 1;
}
.hud-lives img {
  display: block;
  width: 12cqw;
  height: auto;
}
.flash {
  position: absolute;
  top: 24cqw;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9cqw;
  font-weight: 900;
  color: #fff;
  -webkit-text-stroke: 1cqw var(--ink);
  paint-order: stroke fill;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.flash.show {
  opacity: 1;
}
/* カウントダウン（3・2・1・スタート！）は、画面の真ん中に大きく */
.flash.count {
  top: 50%;
  transform: translateY(-50%);
  font-size: 34cqw;
  line-height: 1;
  color: var(--yellow);
  -webkit-text-stroke: 2.4cqw var(--ink);
  transition: none;
}
/* 「スタート！」のように長い言葉は、幅に収まる大きさにする */
.flash.count.long {
  font-size: 17cqw;
}
.flash.count.pop {
  animation: pop 0.45s ease-out;
}
@keyframes pop {
  0% {
    transform: translateY(-50%) scale(1.6);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translateY(-50%) scale(1);
  }
}

/* 音を消すボタン（いつも左上に出す。板より手前） */
.mute {
  position: absolute;
  top: 2.5cqw;
  left: 2.5cqw;
  z-index: 5;
  width: 15cqw;
  height: 15cqw;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.mute img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* 手元の確かめ用の、音を鳴らすボタン（?sfx=1） */
.sfx {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5cqw;
}
.sfx .sub-btn {
  min-height: 8cqw;
  font-size: 3.4cqw;
}

/* タイトルや結果などの板 */
.panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3cqw;
  padding: 8cqw 6cqw 6cqw;
  overflow-y: auto;
  /* 板の中は横に動かす物が無いので、縦のスクロールバーが出ても横には動かさない */
  overflow-x: hidden;
  text-align: center;
  font-size: 4.4cqw;
  line-height: 1.5;
}
.panel h2 {
  margin: 0;
  font-size: 9cqw;
  font-weight: 900;
  color: #fff;
  -webkit-text-stroke: 1cqw var(--ink);
  paint-order: stroke fill;
}
.title {
  justify-content: flex-start;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0%) 55%, rgb(0 0 0 / 35%));
}
.title {
  /* タイトルは中身が多いので、余白を少し詰めて1画面に収める */
  gap: 2.5cqw;
  /* 左上の音のボタンがロゴの「モ」にかからないよう、ロゴを少し下げて小さくする。
     下げすぎると1画面からあふれてスクロールが出るので、余白を残す */
  padding-top: 11cqw;
  padding-bottom: 4cqw;
}
.title-logo {
  width: 80cqw;
  height: auto;
}
.title-sub {
  margin: 0;
  padding: 1.5cqw 4cqw;
  border: 0.8cqw solid var(--ink);
  border-radius: 3cqw;
  background: var(--paper);
  font-size: 4.6cqw;
  font-weight: 900;
}
.big-btn,
.sub-btn {
  font: inherit;
  font-weight: 900;
  color: var(--ink);
  border: 0.9cqw solid var(--ink);
  cursor: pointer;
}
.big-btn {
  min-width: 60cqw;
  padding: 3cqw 6cqw;
  border-radius: 4cqw;
  background: var(--yellow);
  font-size: 8cqw;
  box-shadow: 0 1.4cqw 0 var(--ink);
}
.big-btn:active {
  transform: translateY(1cqw);
  box-shadow: 0 0.4cqw 0 var(--ink);
}
.sub-btn {
  min-height: 11cqw;
  padding: 1.5cqw 5cqw;
  border-radius: 3cqw;
  background: var(--paper);
  font-size: 4.8cqw;
}
.row {
  display: flex;
  gap: 3cqw;
}
.member {
  width: 100%;
  margin-top: auto;
  padding: 3cqw 4cqw;
  border: 0.8cqw solid var(--ink);
  border-radius: 3cqw;
  background: rgb(255 250 240 / 94%);
  font-size: 3.5cqw;
  line-height: 1.45;
}
.member p {
  margin: 0 0 1.5cqw;
}
.member .login {
  display: inline-block;
  padding: 1.8cqw 3.5cqw;
  font-size: 3.8cqw;
  /* ボタンの文字は1行に収める */
  white-space: nowrap;
  border: 0.8cqw solid var(--ink);
  border-radius: 3cqw;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}
.member a {
  color: #1d4ed8;
}
.member .best {
  font-weight: 900;
}
.back {
  color: #fff;
  font-size: 3.6cqw;
  text-decoration: none;
  text-shadow: 0 0 1cqw #000;
}

/* 遊び方 */
.howto,
.result,
.ranking {
  background: rgb(27 19 8 / 72%);
  color: #fff;
}
.rules {
  display: flex;
  flex-direction: column;
  gap: 3cqw;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}
.rules li {
  display: flex;
  align-items: center;
  gap: 3cqw;
  padding: 2cqw 3cqw;
  border-radius: 3cqw;
  background: rgb(255 250 240 / 96%);
  color: var(--ink);
}
.rules img {
  flex: none;
  width: 18cqw;
  height: 18cqw;
  object-fit: contain;
}

/* 結果 */
.result {
  justify-content: center;
}
.result-score {
  margin: 0;
  font-size: 24cqw;
  font-weight: 900;
  line-height: 1;
  color: var(--yellow);
  -webkit-text-stroke: 1.6cqw var(--ink);
  paint-order: stroke fill;
}
.result-score small {
  font-size: 8cqw;
  color: #fff;
}
.result-speed {
  margin: 0;
  font-size: 5cqw;
}
.result-rank {
  width: 100%;
  padding: 3cqw;
  border-radius: 3cqw;
  background: rgb(255 250 240 / 96%);
  color: var(--ink);
  font-size: 4.2cqw;
}
.result-rank p {
  margin: 0.5cqw 0;
}
.result-rank .login {
  display: inline-block;
  margin-top: 1.5cqw;
  padding: 1.5cqw 3.5cqw;
  font-size: 3.8cqw;
  white-space: nowrap;
  border: 0.8cqw solid var(--ink);
  border-radius: 3cqw;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}
/* 記録の共有。目立つ黒い大きなボタン */
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60cqw;
  min-height: 13cqw;
  padding: 2cqw 5cqw;
  border: 0.9cqw solid #fff;
  border-radius: 4cqw;
  background: #000;
  color: #fff;
  font: inherit;
  font-size: 5.6cqw;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 1.2cqw 0 rgb(0 0 0 / 50%);
  cursor: pointer;
}
.share-btn:active {
  transform: translateY(0.8cqw);
  box-shadow: 0 0.4cqw 0 rgb(0 0 0 / 50%);
}
.sharebox {
  justify-content: center;
  background: rgb(27 19 8 / 86%);
  color: #fff;
}
.share-img {
  width: 100%;
  height: auto;
  border: 0.8cqw solid #fff;
  border-radius: 2cqw;
}
.share-how {
  margin: 0;
  font-size: 4cqw;
}
.save-btn {
  text-decoration: none;
  font-size: 6.5cqw;
}

/* ランキング */
.tabs {
  display: flex;
  gap: 2cqw;
}
.tabs button {
  min-height: 10cqw;
  padding: 1cqw 4cqw;
  border: 0.7cqw solid var(--ink);
  border-radius: 3cqw;
  background: rgb(255 250 240 / 60%);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}
.tabs.small button {
  min-height: 9cqw;
  font-size: 3.8cqw;
}
.tabs button[aria-selected='true'] {
  background: var(--yellow);
}
.rank-list {
  width: 100%;
  min-height: 40cqw;
  margin: 0;
  padding: 2cqw 3cqw;
  border-radius: 3cqw;
  background: rgb(255 250 240 / 96%);
  color: var(--ink);
  list-style: none;
  overflow-y: auto;
  flex: 1;
}
.rank-list li {
  display: flex;
  gap: 3cqw;
  padding: 1.2cqw 0;
  border-bottom: 0.3cqw dashed rgb(27 19 8 / 25%);
  text-align: left;
}
.rank-list li.me {
  background: #fff3b0;
}
.rank-list .no {
  width: 10cqw;
  font-weight: 900;
  text-align: right;
}
.rank-list .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-list .val {
  font-weight: 900;
}
.rank-list .empty {
  justify-content: center;
  border: 0;
  color: rgb(27 19 8 / 60%);
}
.rank-mine,
.rank-note {
  margin: 0;
  font-size: 3.8cqw;
}
.noscript {
  padding: 16px;
  color: #fff;
}
