/* g-bomb.css — 폭탄 피하기 (기획 · 남자팀)
   기획서(game_vibe/20260818105008.pdf) 3·4쪽 그림 그대로:
   시작 화면(제목 + 놀이 버튼), 굵은 검은 선의 3×3 / 4×4 표.
   격자의 검은 선과 크림색 칸은 아이 그림 그대로 지킨다. */

.bomb-wrap {
  /* --bsz 는 js 가 게임판(#stage) 높이를 재서 px 로 다시 넣는다.
     아래 값은 js 가 재기 전 한 프레임 동안만 쓰는 예비값이다.
     ("⌨️ 자판" 을 켜면 게임판이 낮아지는데, vh 로만 잡으면 격자가 잘렸다) */
  --bsz: min(52vh, 40vw);
  --n: 3;
  --cell: calc(var(--bsz) / var(--n));
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: clamp(4px, 1vh, 12px) 12px clamp(4px, .8vh, 10px);
  background: radial-gradient(120% 90% at 50% 0%, #1b2233 0%, #0b0f17 70%);
}

/* ---------- 그림 (js 의 SVG) ---------- */
.bsvg { display: block; overflow: visible; }
.bsvg path, .bsvg circle, .bsvg rect, .bsvg ellipse {
  stroke: #2b241d; stroke-width: 2.4;
  stroke-linejoin: round; stroke-linecap: round;
}
.bsvg .bd { fill: #37424f; }
.bsvg .cap { fill: #8d99a8; }
.bsvg .shine { fill: none; stroke: #7f92a8; stroke-width: 5.5; }
.bsvg .cord { fill: none; stroke: #a3773f; stroke-width: 4.6; }
.bsvg .spark { fill: #ffb020; }
.bsvg .fl1 { fill: #ff7a2f; }
.bsvg .fl2 { fill: #ffe08a; }
.bsvg .dp { fill: #6cc3ef; }
.bsvg .dsh { fill: none; stroke: #ffffff; stroke-width: 6; opacity: .85; }
.bsvg .b1 { fill: #ff5230; }
.bsvg .b2 { fill: #ffd166; }
.bsvg .cf { fill: #fff3cf; }
.bsvg .ch { fill: none; stroke-width: 5; }
.bsvg .ct { fill: none; stroke-width: 6; }
.bsvg .g { fill: #faf6ea; }
.bsvg .g2 { fill: none; stroke-width: 3; }
.bsvg .dot { fill: #37424f; }

/* 알림 토스트·큰 보상 안에 들어간 그림 */
.itemflash .bsvg { display: inline-block; width: 1.4em; height: 1.4em; vertical-align: -.34em; }
.gcheer .ic .bsvg { width: 1em; height: 1em; }

/* ---------- 위쪽 표시줄 — 단계 / 남은 시간 / 친 개수 / 숨은 폭탄 ---------- */
.bomb-hud {
  display: flex; align-items: stretch; gap: clamp(8px, 1.6vw, 20px);
  flex: 0 0 auto;
}
.bomb-h {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: clamp(92px, 11vw, 160px);
  padding: clamp(2px, .5vh, 6px) clamp(10px, 1.4vw, 20px);
  border: 2px solid #2f3a4d;
  border-radius: 12px; background: rgba(16, 22, 34, .92);
}
.bomb-h .k {
  font-size: clamp(10px, 1.5vh, 14px); font-weight: 700; color: #93a2ba;
  letter-spacing: .5px;
}
/* 표시줄 숫자는 격자의 낱말보다 작아야 한다 — 낱말이 이 화면의 가장 큰 글자다 */
.bomb-h .v {
  font-size: max(15px, min(clamp(18px, 3vh, 30px), calc(var(--cell) * .19)));
  font-weight: 900; color: #eaf1ff; line-height: 1.15;
  display: flex; align-items: center; gap: .3em;
}
.bomb-h.step .v { color: #ffd977; }
.bomb-h.goal .v i { font-style: normal; }
.bomb-h.goal .v i:first-child { color: #6ee7a0; }
.bomb-h.mine .v { color: #ff9aad; }
.bomb-h.mine .v i { font-style: normal; }
.bomb-h.mine .hico { display: block; width: 1.15em; height: 1.15em; }
.bomb-h.mine .hico .bsvg { width: 100%; height: 100%; }
.bomb-h.time .v { font-variant-numeric: tabular-nums; }
.bomb-h.time.low {
  border-color: #e2504f; background: rgba(58, 16, 22, .95);
  animation: bombLow 1s infinite ease-in-out;
}
.bomb-h.time.low .v { color: #ff8a8a; }
@keyframes bombLow { 50% { box-shadow: 0 0 0 4px rgba(226, 80, 79, .22); } }

/* ---------- 격자 — 기획서 그림처럼 굵은 검은 선의 표 ---------- */
.bomb-boardbox {
  position: relative;
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  margin-top: clamp(3px, .8vh, 10px);
}
.bomb-boardin { position: relative; max-width: 100%; max-height: 100%; }
.bomb-board {
  width: var(--bsz); height: var(--bsz);
  max-width: 100%; max-height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  background: #faf6ea;
  border: 5px solid #16181c;
  box-shadow: 0 18px 46px -14px #000;
  transition: opacity .3s;
}
.bomb-board.done { opacity: .5; filter: grayscale(.45); }
.bomb-board.shake { animation: bombShake .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes bombShake {
  10%, 90% { transform: translate(-3px, 1px); }
  30%, 70% { transform: translate(6px, -2px); }
  50% { transform: translate(-8px, 3px); }
}
/* 틀리게 쳤을 때 — 폭발보다 약하게 한 번 */
.bomb-board.nudge { animation: bombNudge .3s ease-out; }
@keyframes bombNudge {
  20% { transform: translateX(-6px) rotate(-.4deg); }
  55% { transform: translateX(5px) rotate(.35deg); }
  80% { transform: translateX(-3px); }
}

.bomb-cell {
  position: relative;
  border: 3px solid #16181c;
  margin: -1.5px;                 /* 선이 겹쳐 한 줄로 보이게 */
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
  overflow: hidden;
  background: #faf6ea;
  transition: background .18s;
}
.bomb-cell .bw {
  color: #14161a; font-weight: 800; line-height: 1.14;
  text-align: center; overflow-wrap: anywhere; text-wrap: balance;
  font-size: calc(var(--cell) * .30);
}
.bomb-cell .bw.n1, .bomb-cell .bw.n2 { font-size: calc(var(--cell) * .32); }
.bomb-cell .bw.n3 { font-size: calc(var(--cell) * .26); }
.bomb-cell .bw.n4 { font-size: calc(var(--cell) * .21); }
.bomb-cell .bw.n5 { font-size: calc(var(--cell) * .205); }
.bomb-cell .bw.n6 { font-size: calc(var(--cell) * .195); }
/* 이미 친 글자 — 여섯 게임이 같은 초록을 쓴다 */
.bomb-cell .bw .hit { color: #0e9c78; }

.bomb-cell.lock { background: #fff3bf; }
.bomb-cell.lock .bw { color: #4a3b00; }

/* ---------- 칸 안에 겹치는 그림 ---------- */
.bomb-cell .bart { display: none; position: absolute; align-items: center; justify-content: center; }
.bomb-cell .bart.mine, .bomb-cell .bart.drop { inset: 0; }
.bomb-cell .bart.mine .bsvg { width: 68%; height: 68%; }
.bomb-cell .bart.drop .bsvg { width: 56%; height: 56%; }
.bomb-cell .bart.flame {
  top: 2%; right: 3%;
  width: calc(var(--cell) * .30); height: calc(var(--cell) * .30);
}
.bomb-cell .bart.flame .bsvg { width: 100%; height: 100%; }

/* 친 칸 — 낱말이 사라지고 둘레의 폭탄 수가 남는다.
   이 숫자가 이 게임의 유일한 실력 요소라 수에 따라 색을 준다 */
.bomb-cell .bnum {
  display: none;
  font-size: calc(var(--cell) * .28); font-weight: 900; color: #2f7d5b;
}
.bomb-cell.open { background: #e6f4e9; }
.bomb-cell.open .bnum { display: block; }
.bomb-cell.open.c0 { background: #eef8ee; }
.bomb-cell.open.c0 .bnum { color: #8ba394; }
.bomb-cell.open.c1 .bnum { color: #0e9c78; }
.bomb-cell.open.c2 { background: #fdf3dd; }
.bomb-cell.open.c2 .bnum { color: #c98207; }
.bomb-cell.open.c3, .bomb-cell.open.c4,
.bomb-cell.open.c5, .bomb-cell.open.c6 { background: #ffeae8; }
.bomb-cell.open.c3 .bnum { color: #e2504f; }
.bomb-cell.open.c4 .bnum, .bomb-cell.open.c5 .bnum,
.bomb-cell.open.c6 .bnum { color: #b3245e; }
/* 첫 숫자가 나올 때 한 번 짚어 준다 */
.bomb-cell.teach { box-shadow: inset 0 0 0 5px #3ec8a0; z-index: 3; }
.bomb-cell.teach .bnum { animation: bombTeach 1s 3 ease-in-out; }
@keyframes bombTeach { 50% { transform: scale(1.3); } }

/* 숨어 있던 폭탄이 드러난다 */
.bomb-cell.shown { background: #ffe0e4; }
.bomb-cell.shown .bart.mine { display: flex; }
.bomb-cell.shown .bw { opacity: 0; }
.bomb-cell.boom { background: #ff5a5a; transition: none; }
.bomb-cell.boom .bart.mine {
  display: flex;
  animation: bombPop .5s ease-out;
}
@keyframes bombPop {
  0% { transform: scale(.4); }
  55% { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* 심지가 타는 폭탄 — 낱말은 계속 보인다 (다시 쳐야 꺼진다) */
.bomb-cell .bfuse {
  display: none; position: absolute; left: 6%; right: 6%; bottom: 6%;
  height: calc(var(--cell) * .085);
  background: #7a2020; border-radius: 999px; overflow: hidden;
  border: 1.5px solid #2b241d;
}
.bomb-cell .bfuse i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #ffd166, #ff7043);
  transition: width .1s linear;
}
.bomb-cell.fusing {
  background: #ffdfe2;
  animation: bombFuse .45s infinite steps(2);
}
.bomb-cell.fusing .bfuse { display: block; }
.bomb-cell.fusing .bart.flame { display: flex; }
.bomb-cell.fusing .bw { color: #8c1f1f; }
.bomb-cell.fusing .bw .hit { color: #0e9c78; }
@keyframes bombFuse { 50% { background: #ffbcc3; } }
/* 심지가 얼마 안 남았다 — 색이 더 뜨거워진다 */
.bomb-cell.fusing.hot {
  animation-duration: .22s;
  box-shadow: inset 0 0 0 4px #e2504f;
}
.bomb-cell.fusing.hot .bfuse i { background: #e2504f; }
@keyframes bombFuseHot { 50% { background: #ff9aa2; } }
.bomb-cell.fusing.hot { animation-name: bombFuseHot; }

/* 꺼진 폭탄 — 그 칸은 잠긴다 */
.bomb-cell.defused {
  background: #d4ecfa; animation: none;
  box-shadow: inset 0 0 0 4px #5ad4e6;
}
.bomb-cell.defused .bart.drop { display: flex; animation: bombPop .45s ease-out; }

.bomb-flash {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(30vh, 22vw); height: min(30vh, 22vw);
  pointer-events: none;
  animation: bombFlash 1.1s forwards ease-out;
}
.bomb-flash .bsvg { width: 100%; height: 100%; }
@keyframes bombFlash {
  0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.7); opacity: 0; }
}

/* ---------- 1단계를 통과하면 모서리에 나타나는 낱말 (기획서 규칙 6) ---------- */
.bomb-corner { display: none; }
.bomb-corner.on {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  position: absolute; right: 0; top: 0;
  /* 위쪽 표시줄을 가리지 않게 판 안쪽으로 조금 내렸다 (설명이 세 줄로 늘었다) */
  transform: translate(62%, 6%);
  white-space: nowrap;
  padding: clamp(7px, 1.2vh, 15px) clamp(14px, 1.8vw, 28px);
  background: #fff9e2; border: 4px solid #16181c; border-radius: 10px;
  box-shadow: 0 12px 34px -8px #000, 0 0 0 6px rgba(255, 217, 119, .18);
  opacity: 1;
  animation: bombCorner .45s ease-out;
  z-index: 6;
}
.bomb-corner .clab {
  font-size: clamp(12px, 1.9vh, 18px); font-weight: 800; color: #8a5a12;
}
.bomb-corner .cw {
  font-size: clamp(26px, 5.2vh, 54px); font-weight: 900; color: #14161a;
  line-height: 1.1;
}
.bomb-corner .cw .hit { color: #0e9c78; }
/* 남은 시간 보너스 — 빨리 치면 점수가 된다는 것을 여기서 보여 준다 */
.bomb-corner .cbonus {
  margin-top: 2px;
  font-size: clamp(12px, 1.8vh, 17px); font-weight: 800; color: #2f5d3f;
  background: #d8f0dd; border: 2px solid #2b241d; border-radius: 999px;
  padding: 2px 12px;
}
.bomb-corner .cbonus b { color: #0e7a4e; }
@keyframes bombCorner {
  0% { transform: translate(62%, 6%) scale(.55); }
  60% { transform: translate(62%, 6%) scale(1.12); }
  100% { transform: translate(62%, 6%) scale(1); }
}

/* ---------- 아래 한 줄 설명 — 이 게임의 유일한 실력 요소라 눈에 띄게 ---------- */
.bomb-tip {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  margin-top: clamp(4px, .9vh, 10px);
  padding: clamp(3px, .6vh, 7px) clamp(12px, 1.6vw, 22px);
  border: 2px solid #3b4a63; border-radius: 999px;
  background: rgba(20, 30, 46, .95);
  color: #dbe6f5; font-size: clamp(13px, 1.9vh, 19px); font-weight: 700;
  transition: box-shadow .2s, border-color .2s;
}
.bomb-tip .tt { display: block; }
.bomb-tip .ti { display: block; width: 1.7em; height: 1.7em; flex: 0 0 auto; }
.bomb-tip .ti .bsvg { width: 100%; height: 100%; }
.bomb-tip b { color: #6ee7a0; }
.bomb-tip.hi {
  border-color: #3ec8a0; color: #ffffff;
  box-shadow: 0 0 0 5px rgba(62, 200, 160, .25);
  animation: bombTipHi .9s 4 ease-in-out;
}
@keyframes bombTipHi { 50% { box-shadow: 0 0 0 12px rgba(62, 200, 160, .06); } }

/* =========================================================
   시작 화면 — 기획서 3쪽 왼쪽 그림 (제목 + 놀이 버튼)
   ========================================================= */
.bomb-intro {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 20%, #232c3f 0%, #080b11 75%);
}
.bomb-intro-paper {
  text-align: center;
  padding: clamp(12px, 2.4vh, 30px) clamp(24px, 4.5vw, 72px);
  background: #faf6ea;
  border: 5px solid #16181c;
  box-shadow: 0 22px 60px -16px #000;
  max-width: 92%;
}
.bomb-title {
  margin: 0 0 clamp(10px, 1.8vh, 22px);
  font-size: clamp(34px, 8.4vh, 88px); font-weight: 900; color: #14161a;
  line-height: 1; letter-spacing: -.02em;
}
.bomb-title i { font-style: normal; margin-right: .18em; }
.bomb-title b { font-weight: 900; }
.bomb-play {
  font: inherit; cursor: pointer;
  font-size: clamp(20px, 3.8vh, 40px); font-weight: 900; color: #14161a;
  padding: clamp(3px, .7vh, 9px) clamp(26px, 3.6vw, 58px);
  background: #faf6ea; border: 4px solid #16181c; border-radius: 4px;
  transform: rotate(-1.2deg);
  box-shadow: 4px 5px 0 #16181c;
}
.bomb-play:hover { background: #ffe9a8; }
/* 이 게임에 나오는 네 가지를 미리 보여 준다 */
.bomb-introart {
  display: flex; justify-content: center; align-items: flex-end;
  gap: clamp(14px, 3vw, 42px);
  margin-top: clamp(10px, 2vh, 22px);
}
.bomb-introart .bi { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bomb-introart .bi i {
  display: block; width: clamp(38px, 7vh, 68px); height: clamp(38px, 7vh, 68px);
}
.bomb-introart .bi i .bsvg { width: 100%; height: 100%; }
.bomb-introart .bi b {
  font-size: clamp(10px, 1.6vh, 15px); font-weight: 800; color: #3d434e;
}
.bomb-intro-by {
  margin-top: clamp(10px, 1.8vh, 20px);
  font-size: clamp(11px, 1.7vh, 17px); font-weight: 800; color: #8a5a12;
}
.bomb-intro-desc {
  margin-top: 6px; color: #3d434e; font-weight: 600;
  font-size: clamp(12px, 1.9vh, 18px); line-height: 1.55;
}
.bomb-intro-desc b { color: #14161a; }
.bomb-intro-go {
  display: inline-block; margin-top: clamp(8px, 1.5vh, 18px);
  background: #16181c; color: #faf6ea; font-weight: 900;
  font-size: clamp(12px, 1.9vh, 18px);
  padding: 6px 20px; border-radius: 999px;
  animation: bombGo 1.4s infinite ease-in-out;
}
@keyframes bombGo { 50% { transform: scale(1.06); } }

/* 아주 낮은 화면 — 설명 줄을 납작하게 (격자 크기는 js 가 판 높이로 맞춘다) */
@media (max-height: 640px) {
  .bomb-tip { font-size: clamp(11px, 1.7vh, 15px); padding: 2px 12px; gap: 7px; }
  .bomb-introart { gap: clamp(10px, 2vw, 26px); }
}
