/**
 * bloomf 人間判定ゲート（モーダル + ハエ叩き）
 *
 * 本サイトの style.css と一緒に読み込む。
 * ページ側に影響しないよう、スタイルはすべて .gate 配下に閉じる。
 */
@import url('https://fonts.googleapis.com/css2?family=DotGothic16&family=JetBrains+Mono:wght@300;400&family=Noto+Serif+JP:wght@300;400&display=swap');

.gate,
.gate * { margin: 0; padding: 0; box-sizing: border-box; }

/* ── モーダル ── */
.gate {
  --ink:      #e8edf5;
  --ink-dim:  #8ba0c0;
  --ink-line: rgba(255,255,255,0.15);
  --accent:   #a8d0ff;
  --error:    #ff8080;

  font-family: 'Noto Serif JP', serif;
  -webkit-font-smoothing: antialiased;
  /* 本サイトは独自カーソル（cursor: none）。モーダルは最前面に出るので通常のカーソルに戻す */
  cursor: auto;
  overscroll-behavior: contain;   /* モーダル内のスクロールを背後に伝えない */
  width: calc(100% - 32px);
  max-width: 560px;
  margin: auto;
  padding: 0;
  color: var(--ink);
  background: #0a1220;
  border: 1px solid var(--ink-line);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.gate[open] { animation: gate-in 0.35s cubic-bezier(.2,.8,.2,1); }
.gate::backdrop {
  background: rgba(3,6,12,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.gate-inner { padding: 22px 22px 18px; }
.gate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.gate-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 300;
  color: #fff;
}
.gate-close {
  flex: none;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-dim);
  background: none;
  border: 1px solid var(--ink-line);
  border-radius: 50%;
  cursor: pointer;
}
.gate-close:hover,
.gate-close:focus-visible { color: #fff; border-color: rgba(255,255,255,0.4); outline: none; }

.gate-lead {
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* ── ハエ叩きの場（本体と同じ暗い背景 + 方眼） ── */
.gate-arena {
  position: relative;
  height: 280px;
  border: 3px solid #1b2436;
  border-radius: 4px;
  background-color: #050810;
  background-image:
    linear-gradient(rgba(168,208,255,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168,208,255,0.08) 1px, transparent 1px);
  background-size: 12px 12px;
  box-shadow: inset 0 0 0 3px #0c1424;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  image-rendering: pixelated;
  cursor: crosshair; /* ドット絵のハエ叩きカーソルは gate.js で設定 */
}

.gate-fly {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0;
  background: none;
  border: 0;
  cursor: inherit;
  will-change: transform;
}
.gate-fly:focus-visible { outline: 2px dashed var(--accent); outline-offset: 4px; }

.gate-fly svg { display: none; }
.gate-fly[data-frame="a"]   .f-a,
.gate-fly[data-frame="b"]   .f-b,
.gate-fly[data-frame="hit"] .f-hit { display: block; }

.gate-note {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-dim);
}

/* 叩いた瞬間のハエ叩き・星・擬音 */
.gate-slap,
.gate-burst {
  position: absolute;
  pointer-events: none;
}
.gate-slap  { animation: slap 0.28s steps(3) forwards; }
.gate-burst { animation: burst 0.5s steps(4) forwards; }
.gate-pop {
  position: absolute;
  transform: translate(-50%, -100%);
  font-family: 'DotGothic16', monospace;
  font-size: 18px;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  white-space: nowrap;
  pointer-events: none;
  animation: pop 0.8s steps(6) forwards;
}
.gate-pop.is-miss { color: var(--ink-dim); font-size: 15px; }
.gate-pop.is-hit {
  font-size: 20px;
  animation: pop-hold 1.9s steps(12) forwards;
}
.gate-pop.is-alert {
  font-size: 18px;
  color: #ff6b6b;
  animation: pop-hold 1.4s steps(10) forwards;
}

/* ── 詳細 ── */
.gate-detail { animation: detail-in 0.5s ease both; }
.detail-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 4px 16px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.8;
}
.detail-row dt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding-top: 3px;
}
.detail-row dd { color: rgba(255,255,255,0.85); }
.detail-empty {
  font-size: 14px;
  line-height: 1.8;
  color: rgba(255,255,255,0.85);
}
.detail-link {
  display: block;
  width: fit-content;
  margin-top: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.3);
}
.detail-link:hover { color: #fff; border-color: #fff; }

.gate-status {
  min-height: 1.6em;
  margin-top: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
}
.gate-status.is-error { color: var(--error); font-family: 'Noto Serif JP', serif; letter-spacing: 0.04em; }

/* Invisible モードでは何も描画されないが、念のため場所を取らせない */
.gate-turnstile { position: absolute; width: 0; height: 0; overflow: hidden; }

@keyframes gate-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes detail-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes slap {
  from { opacity: 1; transform: scale(1.3); }
  to   { opacity: 0; transform: scale(1); }
}
@keyframes burst {
  from { opacity: 1; transform: scale(0.6); }
  to   { opacity: 0; transform: scale(1.4); }
}
@keyframes pop {
  0%   { opacity: 0; transform: translate(-50%, -60%); }
  20%  { opacity: 1; transform: translate(-50%, -120%); }
  100% { opacity: 0; transform: translate(-50%, -190%); }
}

@keyframes pop-hold {
  0%   { opacity: 0; transform: translate(-50%, -60%); }
  10%  { opacity: 1; transform: translate(-50%, -120%); }
  80%  { opacity: 1; transform: translate(-50%, -120%); }
  100% { opacity: 0; transform: translate(-50%, -150%); }
}

@media (max-width: 480px) {
  .gate-title { font-size: 15px; line-height: 1.6; }
  .gate-inner { padding: 18px 16px 14px; }
  .gate-arena { height: 240px; }
  .detail-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .gate[open],
  .gate-detail { animation: none; }
}
