/* ======================================================================
   Wortbombe (like BombParty)
   ====================================================================== */

/* ---------- Menu card & logo ---------- */
.gc-bp { background: radial-gradient(circle at 50% 55%, #ff9a3c 0%, #b8321b 45%, #3a0f08 100%); }
.gc-bp-bomb { position: relative; width: 56px; display: block; }
.gc-bp-bomb svg { width: 100%; display: block; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
.gc-bp-bomb b { position: absolute; left: 47%; top: 57%; transform: translate(-50%, -50%); color: #fff; font-size: 12px; font-weight: 900; letter-spacing: .5px; }
.bp-logo { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bp-logo-bomb { position: relative; width: 96px; animation: bp-wobble 1.6s ease-in-out infinite; }
.bp-logo-bomb svg { width: 100%; display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
.bp-logo-word {
  font-weight: 900; font-size: 46px; line-height: 1; letter-spacing: .5px;
  background: linear-gradient(180deg, #ffe27a, #ff8a2a 55%, #e0341c); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #3a0f08);
}
@keyframes bp-wobble { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg) translateY(-2px); } }

/* Spark at the end of the fuse */
.bp-spark {
  position: absolute; left: 87.5%; top: 6.5%; width: 18%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff 0 12%, #ffe066 22%, #ff8a1c 45%, rgba(255, 80, 0, 0) 70%);
  animation: bp-spark 140ms steps(2) infinite alternate;
}
@keyframes bp-spark { from { transform: translate(-50%, -50%) scale(.75) rotate(0deg); opacity: .85; } to { transform: translate(-50%, -50%) scale(1.15) rotate(45deg); opacity: 1; } }

/* ---------- Options ---------- */
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg.three .seg-btn { text-align: center; align-items: center; padding: 8px 4px; }

/* ---------- Game screen ---------- */
#screen-bp-game.active {
  display: grid;
  height: var(--bp-vh, 100dvh); min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top" "stage" "panel";
  padding: var(--safe-top) max(10px, var(--safe-right)) max(8px, var(--safe-bottom)) max(10px, var(--safe-left));
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #2a1d1a 0%, var(--bg, #11151c) 70%);
}
#screen-bp-game .topbar { grid-area: top; padding: 8px 0 4px; }
.bp-top { flex: 1; display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; min-width: 0; }
.bp-chip { padding: 5px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.bp-chip b { color: var(--text); }

.bp-stage { grid-area: stage; position: relative; min-height: 0; container-type: size; display: grid; place-items: center; }
.bp-ring { position: relative; width: min(100cqw, 100cqh); aspect-ratio: 1; }

/* Players */
.bp-seat {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: clamp(70px, 26cqmin, 150px); text-align: center; z-index: 2;
  transition: opacity 200ms, filter 200ms;
}
.bp-av {
  width: clamp(34px, 11cqmin, 58px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; font-weight: 900; font-size: clamp(15px, 5cqmin, 26px);
  background: #2b3546; border: 2px solid var(--line); box-shadow: 0 4px 10px rgba(0,0,0,.4);
  transition: transform 200ms, box-shadow 200ms, background 200ms;
}
.bp-nm { font-size: clamp(11px, 3.3cqmin, 15px); font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-hearts { font-size: clamp(9px, 2.6cqmin, 13px); line-height: 1; letter-spacing: -1px; min-height: 1em; }
.bp-typed {
  min-height: 1.5em; max-width: 160%; padding: 1px 8px; border-radius: 8px;
  font-size: clamp(12px, 3.8cqmin, 18px); font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  background: rgba(255,255,255,.08); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: clip;
  visibility: hidden;
}
.bp-typed.show { visibility: visible; }
.bp-typed mark { background: #ffd23f; color: #2a2100; border-radius: 3px; padding: 0 1px; }
.bp-seat.active .bp-av { background: var(--accent); color: var(--accent-text); transform: scale(1.12); box-shadow: 0 0 0 3px rgba(255,210,63,.35), 0 0 22px rgba(255, 150, 40, .6); border-color: var(--accent); }
.bp-seat.active .bp-nm { color: var(--accent); }
.bp-seat.me .bp-nm::after { content: " (du)"; color: var(--muted); font-weight: 400; }
.bp-seat.out { opacity: .35; filter: grayscale(1); }
.bp-seat.offline { opacity: .55; }
.bp-seat.hit .bp-av { animation: bp-hit 800ms ease-out; }
@keyframes bp-hit { 0% { background: #ef4444; transform: scale(1.3); } 100% { transform: scale(1); } }
.bp-pop {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  font-weight: 900; font-size: clamp(12px, 3.6cqmin, 17px); color: #4ade80; white-space: nowrap; pointer-events: none;
  animation: bp-pop 1.1s ease-out forwards;
}
@keyframes bp-pop { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); } 20% { opacity: 1; transform: translate(-50%, -6px) scale(1.05); } 100% { opacity: 0; transform: translate(-50%, -30px); } }

/* Bomb in the middle */
.bp-bomb { position: absolute; left: 50%; top: 50%; width: clamp(110px, 34cqmin, 230px); transform: translate(-50%, -50%); z-index: 1; }
.bp-bomb .bp-bomb-svg { width: 100%; display: block; filter: drop-shadow(0 10px 18px rgba(0,0,0,.6)); }
.bp-bomb .bp-spark { display: none; }
.bp-bomb.lit .bp-spark { display: block; }
.bp-bomb.lit .bp-bomb-svg { animation: bp-tick 1s ease-in-out infinite; }
@keyframes bp-tick { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.bp-syl {
  position: absolute; left: 47%; top: 57%; transform: translate(-50%, -50%);
  font-weight: 900; font-size: clamp(22px, 9cqmin, 54px); letter-spacing: 1px; color: #fff;
  text-shadow: 0 2px 0 #000, 0 0 16px rgba(255,255,255,.25);
}
.bp-arrow {
  position: absolute; left: 47%; top: 57%; width: clamp(80px, 30cqmin, 200px); height: 0;
  transform-origin: 0 50%; transition: transform 260ms cubic-bezier(.3,.8,.3,1.2); z-index: -1; pointer-events: none;
}
.bp-arrow i {
  position: absolute; right: 0; top: 0; transform: translate(0, -50%);
  width: 0; height: 0; border-left: clamp(14px, 4.5cqmin, 26px) solid var(--accent);
  border-top: clamp(9px, 3cqmin, 16px) solid transparent; border-bottom: clamp(9px, 3cqmin, 16px) solid transparent;
  filter: drop-shadow(0 0 6px rgba(255, 180, 40, .7));
}
.bp-bomb.solo .bp-arrow { display: none; }
.bp-boom { position: absolute; left: 47%; top: 55%; transform: translate(-50%, -50%) scale(0); font-size: clamp(60px, 30cqmin, 200px); opacity: 0; pointer-events: none; }
.bp-stage.boom .bp-boom { animation: bp-boom 900ms ease-out; }
.bp-stage.boom .bp-ring { animation: bp-shake 500ms ease-out; }
.bp-stage.boom::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 170, 60, .55), rgba(255, 60, 20, 0) 60%);
  animation: bp-flash 700ms ease-out forwards;
}
@keyframes bp-boom { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 1; } 50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; } }
@keyframes bp-flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes bp-shake { 0%, 100% { transform: none; } 20% { transform: translate(-8px, 4px); } 40% { transform: translate(7px, -5px); } 60% { transform: translate(-5px, 3px); } 80% { transform: translate(3px, -2px); } }

/* ---------- Input panel ---------- */
.bp-panel { grid-area: panel; display: flex; flex-direction: column; gap: 6px; padding-top: 4px; width: min(560px, 100%); justify-self: center; }
#screen-bp-game .status { display: block; text-align: center; font-size: 14px; line-height: 1.35; min-height: 2.7em; padding: 0 4px; }
#screen-bp-game .status .bp-s { color: var(--accent); letter-spacing: .5px; }
.bp-form { display: flex; gap: 8px; }
.bp-form input {
  flex: 1; min-width: 0; height: 52px; padding: 0 14px; border-radius: 14px;
  background: rgba(255,255,255,.06); border: 2px solid var(--line); color: var(--text);
  font: 800 20px/1 system-ui, sans-serif; letter-spacing: 1px; text-transform: uppercase;
  outline: none; transition: border-color 150ms, background 150ms;
}
.bp-form input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 15px; color: var(--muted); }
.bp-form.mine input { border-color: #22c55e; background: rgba(34, 197, 94, .1); box-shadow: 0 0 0 3px rgba(34, 197, 94, .22), 0 0 18px rgba(34, 197, 94, .25); }
.bp-form.mine .bp-send { background: #22c55e; border-color: #22c55e; color: #052e16; box-shadow: 0 6px 18px rgba(34, 197, 94, .3); }
.bp-send { width: 52px; height: 52px; padding: 0; font-size: 22px; border-radius: 14px; }
.bp-form:not(.mine) .bp-send { opacity: .4; }
.bp-form.nope input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, .3); background: rgba(239, 68, 68, .1); animation: bp-nope 320ms ease-out; }
@keyframes bp-nope { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
.bp-letters { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.bp-letters i {
  width: 21px; height: 22px; display: grid; place-items: center; border-radius: 5px; font-style: normal;
  font-size: 11px; font-weight: 800; color: rgba(255,255,255,.35); background: rgba(255,255,255,.05);
}
.bp-letters i.on { color: #2a2100; background: var(--accent); }
.bp-lt-hint { font-size: 11px; color: var(--muted); align-self: center; margin-left: 4px; }
.bp-long { font-size: 12px; letter-spacing: .3px; }
#screen-bp-game .toasts { top: max(54px, calc(var(--safe-top) + 50px)); bottom: auto; flex-direction: column; }

/* Landscape: circle on the left, input on the right */
@media (min-aspect-ratio: 4001/3000) {
  #screen-bp-game.active {
    grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "top top" "stage panel";
    column-gap: 16px;
    padding: max(4px, var(--safe-top)) max(12px, var(--safe-right)) max(6px, var(--safe-bottom)) max(12px, var(--safe-left));
  }
  #screen-bp-game .topbar { padding: 0 0 2px; }
  .bp-panel { align-self: center; }
  #screen-bp-game .status { text-align: left; }
  .bp-letters { justify-content: flex-start; }
}
/* Very low (landscape with keyboard): hide letters and status hint */
@media (max-height: 300px) {
  .bp-letters { display: none; }
  #screen-bp-game .status { min-height: 0; font-size: 12.5px; }
  .bp-form input, .bp-send { height: 42px; }
}

/* Typed letters: red until the syllable appears, then green */
.bp-form input.syl-no { color: #ff5c5c; }
.bp-form input.syl-ok { color: #4ade80; }

/* ---------- Room rules (like JKLM) ---------- */
.bp-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.bp-opt { min-width: 0; }
.bp-opt.wide { grid-column: 1 / -1; }
.bp-opt .mode-title i { font-style: normal; font-size: 12px; }
.bp-step { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.bp-step .btn { width: 40px; height: 40px; padding: 0; font-size: 22px; font-weight: 800; border-radius: 11px; flex: none; }
.bp-step b { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; min-width: 1.6em; text-align: right; }
.bp-step small { flex: 1; font-size: 12px; color: var(--muted); }
.seg.four { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg.four .seg-btn, .seg.two .seg-btn { text-align: center; align-items: center; padding: 8px 2px; }
.seg.four .seg-btn b::after, .seg.three .seg-btn b::after, .seg.two .seg-btn b::after { content: none; }
.seg.two { grid-template-columns: 1fr 1fr; }
.bp-custom { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 8px; }
.bp-num { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.bp-num input, .bp-bonus-in {
  height: 42px; padding: 0 10px; border-radius: 11px; border: 1px solid var(--line);
  background: rgba(255,255,255,.06); color: var(--text); font: 800 16px/1 system-ui, sans-serif;
}
.bp-num input { width: 90px; text-align: right; font-variant-numeric: tabular-nums; }
.bp-bonus-row { display: flex; gap: 8px; }
.bp-bonus-in { flex: 1; min-width: 0; letter-spacing: .5px; font-size: 14px; text-transform: uppercase; }
.bp-pool { margin: 6px 2px 0; }
.bp-opts input:disabled { opacity: .7; }
@media (max-width: 420px) {
  .seg.four .seg-btn small { font-size: 10.5px; }
  .bp-custom { grid-template-columns: 1fr; }
}
