* {
  box-sizing: border-box;
}

@font-face {
  font-family: "NyansaRounded";
  src: url("./fonts/m-plus-rounded-1c-japanese-400-normal.woff2?v=1") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "NyansaRounded";
  src: url("./fonts/m-plus-rounded-1c-japanese-700-normal.woff2?v=1") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* JSで実測した空き高さに合わせて上書きする。初期値は安全寄り。 */
  --gap: clamp(2px, 0.8vmin, 4px);
  --board-pad: clamp(4px, 1.2vmin, 6px);
  --cell-size: 30px;
  --content-width: 320px;
  --side-width: calc(var(--cell-size) + 22px);
  --next-width: var(--side-width);
  --score-width: clamp(136px, 34vw, 176px);
  --status-height: 48px;
  --game-area-gap: clamp(6px, 2vw, 10px);
  --board-status-gap: 6px;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "NyansaRounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #eaf4ff 0%, #f8fbff 48%, #fff2f7 100%);
  color: #253044;
  display: flex;
  justify-content: center;
  align-items: stretch;
  touch-action: none;
}

/* スマホではWebページではなくゲーム画面として扱う。
   ダブルタップズーム、テキスト選択、長押しメニュー、画像ドラッグを抑える。 */
.app,
.app * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.app img {
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
}

button {
  touch-action: manipulation;
}

/* Ver0.42: ★1バッジ返礼品用の簡易パスワード画面。 */
.auth-screen {
  width: 100vw;
  min-height: 100dvh;
  padding: 18px;
  display: grid;
  place-items: center;
}

.auth-screen.is-hidden {
  display: none;
}

.auth-screen,
.auth-screen * {
  touch-action: auto;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

.auth-input {
  ime-mode: auto;
}

.auth-card {
  width: min(420px, 100%);
  padding: clamp(22px, 6vw, 34px);
  border-radius: 26px;
  background: rgba(255,255,255,0.84);
  box-shadow: 0 16px 36px rgba(60, 90, 120, 0.18);
  text-align: center;
}

.auth-logo {
  display: block;
  width: min(300px, 92%);
  height: auto;
  margin: 0 auto 14px;
}

.auth-lead {
  margin: 0 0 4px;
  font-weight: 800;
  color: #263143;
}

.auth-text {
  margin: 0 0 16px;
  color: #556274;
  font-size: 0.94rem;
}

.auth-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.auth-input {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid rgba(80, 105, 135, 0.22);
  border-radius: 14px;
  background: #fff;
  color: #253044;
  font: inherit;
}

.auth-button {
  border: 0;
  border-radius: 14px;
  padding: 0 15px;
  background: #ffffff;
  color: #263143;
  box-shadow: 0 6px 16px rgba(60, 90, 120, 0.16);
  font-weight: 800;
  cursor: pointer;
}

.auth-message {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: #d34d62;
  font-size: 0.88rem;
}

.app.is-locked {
  display: none;
}

.app {
  width: 100vw;
  height: 100dvh;
  padding: clamp(8px, 2.4vmin, 14px);
  display: grid;
  grid-template-rows: auto auto var(--status-height);
  gap: clamp(6px, 1.7vmin, 10px);
  justify-items: center;
  align-content: start;
  overflow: hidden;
}

.game-header {
  width: var(--content-width);
  max-width: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 0;
}


.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(4px, 1.2vw, 6px);
  flex: 0 0 auto;
  margin-left: auto;
}


.icon-button {
  width: clamp(32px, 7.5vw, 40px);
  height: clamp(32px, 7.5vw, 40px);
  padding: 0;
  border: 0;
  border-radius: clamp(11px, 3vw, 14px);
  background: rgba(255,255,255,0.86);
  color: #263143;
  box-shadow: 0 6px 16px rgba(60, 90, 120, 0.14);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}


.icon-button::before {
  content: "";
  width: 18px;
  height: 18px;
  display: block;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.icon-button.is-exit::before {
  width: 16px;
  height: 16px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.icon-button.is-hidden {
  display: none;
}

.score-box {
  width: var(--score-width);
  min-width: 0;
  flex: 0 0 var(--score-width);
  padding: clamp(5px, 1.5vmin, 7px) clamp(8px, 2.4vmin, 12px);
  padding-left: clamp(8px, 1.8vmin, 11px);
  padding-right: clamp(8px, 1.8vmin, 11px);
  border-radius: 14px;
  background: rgba(255,255,255,0.78);
  box-shadow: 0 6px 18px rgba(60, 90, 120, 0.14);
  text-align: right;
  overflow: hidden;
}


.score-line {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: clamp(5px, 1.2vw, 8px);
}


.score-line + .score-line {
  margin-top: 2px;
}

.score-box span {
  display: block;
  font-size: clamp(0.48rem, 1.7vw, 0.6rem);
  opacity: 0.65;
  line-height: 1;
}


.score-box strong {
  display: block;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: clamp(0.82rem, 2.8vw, 1.08rem);
  line-height: 1.05;
}


.current-score strong {
  font-size: clamp(0.92rem, 3.2vw, 1.16rem);
}


.best-score {
  opacity: 0.86;
}

.game-area {
  width: var(--content-width);
  max-width: none;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: var(--game-area-gap);
  min-height: 0;
  overflow: visible;
  position: relative;
  z-index: 1;
}


.board {
  --board-bg-opacity: 1.00;
  width: calc(var(--cell-size) * 6 + var(--gap) * 5 + var(--board-pad) * 2);
  height: calc(var(--cell-size) * 12 + var(--gap) * 11 + var(--board-pad) * 2);
  padding: var(--board-pad);
  border-radius: clamp(12px, 4vmin, 18px);
  background: rgba(0, 127, 255, 0.30);
  box-shadow: 0 10px 24px rgba(32, 48, 72, 0.20);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(6, var(--cell-size));
  grid-template-rows: repeat(12, var(--cell-size));
  gap: var(--gap);
  flex: 0 0 auto;
  touch-action: none;
}


.board::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("images/board_bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: var(--board-bg-opacity);
  pointer-events: none;
  z-index: 0;
}


.board::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: /*rgba(255,255,255,0.12)*/rgba(255,255,255,0.10);/* 盤面背景画像に白ベール */
  pointer-events: none;
  z-index: 0;
}

/* 立ち絵が入ってもネコとマス目を前面に出す */
.board .cell {
  z-index: 2;
}

.cell {
  position: relative;
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: clamp(6px, 2vmin, 10px);
  background: /*rgba(255,255,255,0.12)*/rgba(255,255,255,0.07);/* セル色・透過性 */
  display: grid;
  place-items: center;
  line-height: 1;
  overflow: hidden;
  user-select: none;
}

.cell.filled {
  /*background: transparent;*//* これを有効にするとネコが着地したセルが非表示になる */
  box-shadow: none;
}

.cell img {
  position: relative;
  z-index: 1;
  width: 94%;
  height: 94%;
  object-fit: contain;
  display: none;
  pointer-events: none;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,0.16));
}

.cell.active img {
  transform: translateY(-1px) scale(1.03);
  filter: drop-shadow(0 0 5px rgba(255, 238, 120, 0.95)) drop-shadow(0 2px 1px rgba(0,0,0,0.16));
}

.cell.active {
  outline: none;
}

.cell.danger::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: rgba(255, 55, 70, 0.42);
  box-shadow: inset 0 0 0 2px rgba(255, 80, 90, 0.62), 0 0 8px rgba(255, 60, 70, 0.45);
  pointer-events: none;
  z-index: 2;
}

.cell.danger img {
  filter: drop-shadow(0 0 5px rgba(255, 238, 120, 0.95)) drop-shadow(0 2px 1px rgba(0,0,0,0.16)) saturate(0.85);
}

.cell.clearing {
  animation: pop 0.18s ease-out 2 alternate;
}

@keyframes pop {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}

.next-panel {
  width: var(--next-width);
  padding: clamp(5px, 1.8vmin, 8px) clamp(4px, 1.5vmin, 6px);
  border-radius: 16px;
  background: rgba(255,255,255,0.78);
  box-shadow: 0 8px 22px rgba(60, 90, 120, 0.14);
  text-align: center;
  flex: 0 0 auto;
}

.next-title {
  margin-bottom: 4px;
  font-size: clamp(0.58rem, 2.4vw, 0.72rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0.7;
  line-height: 1;
}

.next-piece {
  display: grid;
  gap: var(--gap);
  justify-content: center;
}

.next-cat {
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: clamp(6px, 2vmin, 10px);
  background: transparent;
  box-shadow: none;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.next-cat img {
  width: 94%;
  height: 94%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,0.14));
}

.status-panel {
  width: var(--content-width);
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--next-width);
  gap: 6px;
  column-gap: var(--game-area-gap);
  align-items: stretch;
  height: var(--status-height);
  min-height: 0;
  margin-top: var(--board-status-gap, 6px);
  position: relative;
  z-index: 5;
}


.message {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(5px, 1.2vmin, 7px) clamp(8px, 2.4vmin, 12px);
  padding-top: 6px;
  padding-bottom: 6px;
  border-radius: 14px;
  background: rgba(255,255,255,0.78);
  box-shadow: 0 6px 18px rgba(60, 90, 120, 0.10);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  white-space: pre-line;
  font-size: clamp(0.72rem, 3vw, 0.9rem);
  line-height: 1.25;
  overflow: hidden;
}


.restart-button {
  width: 100%;
  min-width: 0;
  height: 100%;
  flex: none;
  padding: 0 clamp(6px, 1.8vmin, 10px);
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(60, 90, 120, 0.16);
  font-family: inherit;
  font-size: clamp(0.58rem, 2.4vw, 0.72rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}


@media (max-height: 650px) {
  .app {
    gap: 5px;
    padding: 7px;
  }
}


.game-header > div:first-child {
  min-width: 0;
}


/* Ver0.28: ポーズボタン。全画面ボタンと同じ見た目で、CSSマスクだけ差し替える。 */
.pause-button::before {
  width: 16px;
  height: 18px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 5v14M17 5v14' fill='none' stroke='black' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 5v14M17 5v14' fill='none' stroke='black' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.pause-button.is-paused::before {
  width: 17px;
  height: 18px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Ver0.28: テキストタイトルをロゴ画像化。右側にポーズ、ミュート、全画面、SCOREを固定配置。 */
.logo-box {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

.game-logo {
  display: block;
  height: clamp(38px, 9.5vw, 50px);
  width: auto;
  max-width: min(210px, 100%);
  object-fit: contain;
}


/* 音量ON */
.mute-button::before {
  width: 19px;
  height: 19px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9H4zM16.5 8.5a5 5 0 0 1 0 7M18.8 6.2a8.2 8.2 0 0 1 0 11.6' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9H4zM16.5 8.5a5 5 0 0 1 0 7M18.8 6.2a8.2 8.2 0 0 1 0 11.6' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ミュート中 */
.mute-button.is-muted::before {
  width: 19px;
  height: 19px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9H4zM16 9l5 5M21 9l-5 5' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9H4zM16 9l5 5M21 9l-5 5' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

@media (max-width: 420px) {
  .game-logo {
    height: clamp(34px, 8.5vw, 42px);
    max-width: min(170px, 100%);
  }
}


.score-box.score-flash {
  animation: scoreFlash 0.42s ease-out 1;
}

@keyframes scoreFlash {
  0% {
    transform: scale(1);
    box-shadow: 0 6px 18px rgba(60, 90, 120, 0.14);
  }
  45% {
    transform: scale(1.045);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.95), 0 0 18px rgba(255, 222, 105, 0.85);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 6px 18px rgba(60, 90, 120, 0.14);
  }
}

.cell.azure-bonus-row {
  animation: azureBonusRowFlash 0.16s ease-in-out 4 alternate;
  background: rgba(143, 227, 255, 0.34);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.72), 0 0 14px rgba(71, 202, 255, 0.72);
}

.cell.azure-bonus-row::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.96), transparent);
  transform: translateX(-120%);
  animation: azureBonusSweep 0.34s ease-out 1;
  pointer-events: none;
  z-index: 3;
}

@keyframes azureBonusRowFlash {
  from { filter: brightness(1); }
  to { filter: brightness(1.55); }
}

@keyframes azureBonusSweep {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}


/* Ver0.50: 開発者用サウンドチェックパネル。
   通常レイアウトのgrid内に置くと、画面高さによって見た目とクリック判定がずれる環境があったため、
   fixedの独立パネルとして表示する。 */
.debug-panel {
  position: fixed;
  left: 50%;
  bottom: calc(var(--status-height) + var(--help-button-size, 40px) + 26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1000;
  width: min(var(--content-width), calc(100vw - 20px));
  max-height: min(46dvh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255,255,255,0.30);
  box-shadow: 0 10px 28px rgba(32, 48, 72, 0.28);
  pointer-events: auto;
  touch-action: manipulation;
}

.debug-panel.is-hidden {
  display: none;
}

.debug-title {
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  opacity: 0.7;
  text-align: center;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.debug-grid button {
  min-width: 0;
  min-height: 34px;
  padding: 7px 5px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.30);
  color: #263143;
  box-shadow: 0 4px 10px rgba(60, 90, 120, 0.12);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.debug-grid button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(60, 90, 120, 0.16);
}

@media (max-height: 760px) {
  .debug-panel {
    padding: 6px;
    max-height: min(38dvh, 300px);
  }
  .debug-grid {
    gap: 4px;
  }
  .debug-grid button {
    min-height: 32px;
    padding: 5px 4px;
    font-size: 0.66rem;
  }
}


/* Ver1.20: 右サイド列。NEXTの下にヘルプを置き、盤面下端とヘルプ下端を揃える。 */
.side-column {
  width: var(--next-width);
  height: calc(var(--cell-size) * 12 + var(--gap) * 11 + var(--board-pad) * 2);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: var(--game-area-gap);
  flex: 0 0 var(--next-width);
}

.side-column .next-panel {
  width: 100%;
  flex: 0 0 auto;
}

.side-help-button {
  width: clamp(32px, 7.5vw, 40px);
  height: clamp(32px, 7.5vw, 40px);
  margin-top: auto;
  padding: 0;
  border: 0;
  border-radius: clamp(11px, 3vw, 14px);
  background: rgba(255,255,255,0.86);
  color: #263143;
  box-shadow: 0 6px 16px rgba(60, 90, 120, 0.16);
  font-size: clamp(1rem, 3vw, 1.15rem);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  display: grid;
  place-items: center;
  align-self: center;
}

.side-help-button:active {
  transform: translateY(1px);
  box-shadow: 0 3px 10px rgba(60, 90, 120, 0.18);
}


/* Ver1.20: ヘルプ画面。初代の読みやすさを保ち、少しだけ透過させる。 */
.help-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(34, 48, 72, 0.30);
  pointer-events: auto;
  touch-action: auto;
}

.help-modal.is-hidden {
  display: none;
}

.help-card {
  width: min(460px, 100%);
  max-height: min(86dvh, 720px);
  overflow: hidden;
  border-radius: 22px;
  background: rgba(255,255,255,0.80);
  box-shadow: 0 18px 42px rgba(32, 48, 72, 0.30);
  color: #253044;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(255,255,255,0.34);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px 18px;
  border-bottom: 1px solid rgba(80, 105, 135, 0.14);
}

.help-header h2 {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.22rem);
  letter-spacing: 0.04em;
}

.help-close-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: #263143;
  box-shadow: 0 4px 12px rgba(60, 90, 120, 0.14);
  cursor: pointer;
  touch-action: manipulation;

  position: relative;
  display: block;

  font-size: 0;
  line-height: 0;
  overflow: hidden;
}

.help-close-button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.help-content {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 18px 18px;
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

.help-section + .help-section {
  margin-top: 13px;
}

.help-section h3 {
  margin: 0 0 5px;
  font-size: clamp(0.84rem, 3.4vw, 1rem);
  color: #263143;
}

.help-section p {
  margin: 0;
  font-size: clamp(0.74rem, 3.1vw, 0.9rem);
  line-height: 1.55;
  color: #4d5c70;
}

.help-section p + p {
  margin-top: 4px;
}

@media (max-width: 420px) {
  .help-card {
    border-radius: 18px;
  }
  .help-header {
    padding: 12px 12px 8px 15px;
  }
  .help-content {
    padding: 10px 15px 15px;
  }
}


.restart-button.is-start {
  background: #8899dd;
}

.restart-button.is-reset {
  background: #ffbbbb;
}

#chain-popup {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  pointer-events: none;
  font-family: "NyansaRounded", sans-serif;
  font-size: clamp(20px, 5vw, 34px);
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 0 6px rgba(0,0,0,.8), 0 0 12px rgba(136,153,221,.9);
  opacity: 0;
  z-index: 60;
  white-space: nowrap;
}

.chain-popup-show{animation:chainPopup .9s ease-out;}
@keyframes chainPopup{
  0%{opacity:0;transform:translate(-50%,-40%) scale(.8);}
  15%{opacity:1;transform:translate(-50%,-50%) scale(1.15);}
  100%{opacity:0;transform:translate(-50%,-65%) scale(1);}
}

.board-flash {
  animation: boardFlash .48s ease-out;
}

@keyframes boardFlash {
  0%, 100% {
    filter: none;
    box-shadow: 0 10px 24px rgba(32, 48, 72, 0.20);
  }

  50% {
    filter: brightness(1.32) saturate(1.12);
    box-shadow:
      0 10px 24px rgba(32, 48, 72, 0.20),
      0 0 22px rgba(255, 240, 150, 0.95),
      0 0 44px rgba(255, 215, 90, 0.58);
  }
}

.azure-flash {
  animation: azureFlash .58s ease-out;
}

@keyframes azureFlash {
  0%, 100% {
    filter: none;
    box-shadow: 0 10px 24px rgba(32, 48, 72, 0.20);
  }

  50% {
    filter: brightness(1.34) saturate(1.24);
    box-shadow:
      0 10px 24px rgba(32, 48, 72, 0.20),
      0 0 26px rgba(120, 205, 255, 0.98),
      0 0 56px rgba(80, 170, 255, 0.70);
  }
}

.live-notice {
  width: 100%;
  min-height: clamp(34px, 7.5vw, 42px);
  padding: 6px 4px;
  border-radius: clamp(11px, 3vw, 14px);
  background: rgba(255, 255, 255, 0.90);
  color: #263143;
  box-shadow:
    0 6px 16px rgba(60, 90, 120, 0.16),
    0 0 18px rgba(120, 205, 255, 0.60);
  text-decoration: none;
  display: grid;
  place-items: center;
  gap: 3px;
  font-family: "NyansaRounded", system-ui, sans-serif;
  font-weight: 800;
  pointer-events: auto;
  animation: liveNoticePulse 1.8s ease-in-out infinite;
}

.live-notice.is-hidden {
  display: none;
}

.live-notice-badge {
  display: block;
  padding: 3px 7px;
  border-radius: 999px;
  background: #ff6f91;
  color: #fff;
  font-size: clamp(0.48rem, 1.8vw, 0.62rem);
  letter-spacing: 0.08em;
  line-height: 1;
}

.live-notice-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  white-space: pre-line;
  text-align: center;
  font-size: clamp(0.52rem, 2vw, 0.66rem);
  line-height: 1.15;
}

@keyframes liveNoticePulse {
  0%, 100% {
    box-shadow:
      0 6px 16px rgba(60, 90, 120, 0.16),
      0 0 12px rgba(120, 205, 255, 0.38);
  }
  50% {
    box-shadow:
      0 6px 18px rgba(60, 90, 120, 0.20),
      0 0 24px rgba(120, 205, 255, 0.85);
  }
}
/* Ver1.30: START / PAUSE / GAME OVER の盤面オーバーレイ演出。 */
.state-overlay {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: inherit;
  pointer-events: none;
  text-align: center;
  color: #fff;
  font-family: "NyansaRounded", system-ui, sans-serif;
  text-shadow:
    0 0 8px rgba(0, 0, 0, 0.70),
    0 0 16px rgba(80, 120, 190, 0.70);
}

.state-overlay.is-hidden {
  display: none;
}

.state-overlay-ready,
.state-overlay-pause,
.state-overlay-gameover {
  background: rgba(28, 42, 68, 0.58);
  backdrop-filter: blur(2.2px) saturate(0.86);
  -webkit-backdrop-filter: blur(2.2px) saturate(0.86);
  animation: stateOverlayFadeIn 0.18s ease-out 1;
}

.state-overlay-start {
  background: transparent;
  animation: stateStartFlash 0.78s ease-out 1 forwards;
}

.state-overlay-inner {
  display: grid;
  gap: 8px;
  align-items: center;
  justify-items: center;
  transform: translateY(-2px);
}

.state-overlay-title {
  font-size: clamp(24px, 6vw, 42px);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.05;
}

.state-overlay-ready .state-overlay-title {
  font-size: clamp(21px, 5.4vw, 34px);
  letter-spacing: 0.04em;
}

.state-overlay-pause .state-overlay-title,
.state-overlay-gameover .state-overlay-title,
.state-overlay-start .state-overlay-title {
  font-size: clamp(28px, 7vw, 48px);
}

.state-overlay-subtitle,
.state-overlay-score {
  white-space: pre-line;
  font-size: clamp(12px, 3.2vw, 17px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.state-overlay-score {
  font-size: clamp(11px, 2.9vw, 15px);
  opacity: 0.92;
}

.state-overlay-action {
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  margin: 0 0.18em;
  text-shadow: none;
}

.state-overlay-start-button {
  min-width: 56px;
  height: 28px;
  padding: 0 11px;
  border-radius: 10px;
  background: #8899dd;
  color: #ffffff;
  box-shadow:
    0 5px 14px rgba(32, 48, 72, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  font-size: clamp(0.62rem, 2.4vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
}

.state-overlay-resume-button {
  width: clamp(32px, 7.5vw, 40px);
  height: clamp(32px, 7.5vw, 40px);
  border-radius: clamp(11px, 3vw, 14px);
  background: rgba(255, 255, 255, 0.92);
  color: #263143;
  box-shadow: 0 6px 16px rgba(32, 48, 72, 0.24);
}

.state-overlay-play-icon {
  display: block;
  width: 17px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}

.state-overlay-gameover .state-overlay-inner {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.26),
    0 0 24px rgba(120, 205, 255, 0.30);
}

@keyframes stateOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes stateStartFlash {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  18% {
    opacity: 1;
    transform: scale(1.06);
  }
  55% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.02);
  }
}
