/* =========================================================
   BUBBLE BLAST – style.css
   Typingway.com | Clean, Modern, Addictive Typing Game
   ========================================================= */

/* ── RESET & BASE ─────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --accent:        #8b0000;
  --accent-mid:    #c0392b;
  --accent-light:  #e74c3c;
  --accent-glow:   rgba(139, 0, 0, 0.18);

  --bg:            #f4f6fb;
  --bg-card:       #ffffff;
  --bg-arena:      #eef1f8;

  --text-primary:  #1a1a2e;
  --text-secondary:#555577;
  --text-muted:    #8888aa;

  --bubble-1:      #d6eaff;
  --bubble-2:      #d9f5e8;
  --bubble-3:      #fce8ff;
  --bubble-4:      #fff3d6;
  --bubble-5:      #e8eeff;
  --bubble-danger: #ffe0de;
  --bubble-dead:   #ffbbb8;

  --shadow-sm:     0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:     0 6px 24px rgba(0,0,0,0.10);
  --shadow-lg:     0 16px 48px rgba(0,0,0,0.13);

  --radius-sm:     8px;
  --radius-md:     16px;
  --radius-lg:     24px;
  --radius-xl:     40px;
  --radius-full:   9999px;

  --font-display:  'Fredoka One', cursive;
  --font-body:     'Nunito', sans-serif;

  --transition:    0.22s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}


/**********SEO Article**************/
.game-article-bgry
{
    padding: 22px 26px;
    max-width: 520px;
    text-align: left;
    margin: 0 auto;
    margin-bottom: 18px;
}
.game-article-bgry h1, h2, h3
{
    color: darkred;
    margin-top: 16px;
    margin-bottom: 16px;
}
.game-article-bgry ul
{
    padding-left: 18px;
}
.game-article-bgry ul li
{
    margin-top: 10px;
    margin-bottom: 10px;
}
.game-article-bgry p
{
    margin-top: 10px;
    margin-bottom: 10px;
}
.game-article-bgry a
{
    text-decoration: none;
    color: dodgerblue;
}
/**********SEO Article**************/




/* ── UTILITY ───────────────────────────────────────── */
.hidden { display: none !important; }

/* ── HEADER ────────────────────────────────────────── */
.site-header {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--accent);
}

.site-logo img {
  border-radius: var(--radius-sm);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
}

.nav-link {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover,
.nav-link:focus-visible {
  background: var(--accent-glow);
  color: var(--accent);
  outline: none;
}

/* ── MAIN ──────────────────────────────────────────── */
main {
  flex: 1;
  position: relative;
}

/* ── INTRO SECTION ─────────────────────────────────── */
.game-intro {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  text-align: center;
}

.intro-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.game-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 5rem);
  color: var(--accent);
  line-height: 1;
  letter-spacing: 0.01em;
  text-shadow: 0 4px 16px var(--accent-glow);
}

.game-tagline {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3vw, 1.4rem);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.game-description {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 540px;
  line-height: 1.7;
}

/* Difficulty */
.difficulty-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.difficulty-label {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.difficulty-buttons {
  display: flex;
  gap: 0.6rem;
}

.diff-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  border: 2px solid #dde0ee;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.diff-btn:hover,
.diff-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.diff-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* How to play */
.how-to-play {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  text-align: left;
  box-shadow: var(--shadow-sm);
  max-width: 480px;
  width: 100%;
}

.how-to-play h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent);
  margin-bottom: 0.85rem;
  letter-spacing: 0.02em;
}

.how-to-play ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.how-to-play li {
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── BUTTONS ───────────────────────────────────────── */
.btn-start {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-full);
  padding: 0.85rem 2.8rem;
  cursor: pointer;
  box-shadow: 0 6px 24px var(--accent-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
  overflow: hidden;
}

.btn-start::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  opacity: 0;
  transition: opacity 0.15s;
  border-radius: inherit;
}

.btn-start:hover::after { opacity: 1; }

.btn-start:hover,
.btn-start:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px var(--accent-glow);
  outline: none;
}

.btn-start:active { transform: translateY(0); }

.btn-secondary {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: var(--radius-full);
  padding: 0.75rem 2rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: var(--accent-glow);
  outline: none;
}

/* ── GAME HUD ──────────────────────────────────────── */
.game-section {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 58px);
  max-height: calc(100vh - 58px);
  overflow: hidden;
}

.game-hud {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  flex-shrink: 0;
  gap: 1rem;
  z-index: 10;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 80px;
}

.hud-center {
  align-items: center;
  flex: 1;
}

.hud-right {
  align-items: flex-end;
}

.hud-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.hud-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--accent);
  line-height: 1;
}

.combo-value {
  transition: transform 0.15s cubic-bezier(.36,2,.6,1), color 0.2s;
}

.combo-value.pop {
  animation: comboPop 0.35s cubic-bezier(.36,2,.6,1);
}

.hud-lives {
  display: flex;
  gap: 0.3rem;
  font-size: 1.3rem;
  line-height: 1;
}

.life-icon {
  transition: opacity 0.3s, filter 0.3s;
}

.life-icon.lost {
  opacity: 0.25;
  filter: grayscale(1);
}

.hud-level {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── GAME ARENA ────────────────────────────────────── */
.game-arena {
  flex: 1;
  position: relative;
  background: var(--bg-arena);
  background-image:
    radial-gradient(circle at 20% 80%, rgba(139,0,0,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(100,120,200,0.04) 0%, transparent 50%);
  overflow: hidden;
}

/* Subtle grid texture */
.game-arena::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(0,0,0,0.025) 39px, rgba(0,0,0,0.025) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(0,0,0,0.025) 39px, rgba(0,0,0,0.025) 40px);
  pointer-events: none;
}

/* ── BUBBLES ───────────────────────────────────────── */
.bubble {
  position: absolute;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  cursor: default;
  user-select: none;
  will-change: transform, opacity;
  box-shadow:
    inset 0 -4px 12px rgba(255,255,255,0.7),
    inset 0 4px 8px rgba(255,255,255,0.5),
    0 4px 16px rgba(0,0,0,0.08);
  transition: background-color 0.4s ease, box-shadow 0.4s ease, transform 0.15s ease;
  animation: bubbleRise linear forwards;
  padding: 0.2rem;
  text-align: center;
  line-height: 1.2;
  letter-spacing: 0.02em;
  z-index: 2;
}

.bubble::before {
  content: '';
  position: absolute;
  width: 30%;
  height: 20%;
  top: 16%;
  left: 22%;
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-full);
  transform: rotate(-30deg);
  pointer-events: none;
}

.bubble.danger {
  background-color: var(--bubble-danger) !important;
  animation-name: bubbleRise, bubblePulse;
  animation-timing-function: linear, ease-in-out;
}

.bubble.critical {
  background-color: var(--bubble-dead) !important;
  animation-name: bubbleRise, bubblePulse;
  animation-timing-function: linear, ease-in-out;
}

.bubble .typed-progress {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.58rem;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-mid);
  white-space: nowrap;
  overflow: hidden;
  max-width: 90%;
}

/* Bubble animations */
@keyframes bubbleRise {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-110vh) scale(1); }
}

@keyframes bubblePulse {
  0%, 100% { box-shadow:
    inset 0 -4px 12px rgba(255,255,255,0.7),
    inset 0 4px 8px rgba(255,255,255,0.5),
    0 4px 16px rgba(200,0,0,0.14);
  }
  50% { box-shadow:
    inset 0 -4px 12px rgba(255,255,255,0.7),
    inset 0 4px 8px rgba(255,255,255,0.5),
    0 6px 28px rgba(200,0,0,0.35),
    0 0 0 4px rgba(200,0,0,0.12);
  }
}

@keyframes bubblePop {
  0%   { transform: scale(1); opacity: 1; }
  40%  { transform: scale(1.35); opacity: 0.9; }
  60%  { transform: scale(1.15); opacity: 0.6; }
  80%  { transform: scale(1.5); opacity: 0.2; }
  100% { transform: scale(0.2); opacity: 0; }
}

@keyframes comboPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

@keyframes scoreFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  80%  { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-55px) scale(0.7); }
}

@keyframes arenaShake {
  0%, 100% { transform: translate(0, 0); }
  15%  { transform: translate(-4px, 2px); }
  30%  { transform: translate(4px, -2px); }
  45%  { transform: translate(-3px, 3px); }
  60%  { transform: translate(3px, -1px); }
  75%  { transform: translate(-2px, 2px); }
}

.arena-shake {
  animation: arenaShake 0.38s ease !important;
}

/* ── SCORE FLOAT EFFECT ────────────────────────────── */
.score-float {
  position: absolute;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--accent);
  pointer-events: none;
  animation: scoreFloat 0.8s ease forwards;
  z-index: 10;
  text-shadow: 0 2px 8px var(--accent-glow);
}

/* ── POP PARTICLES ─────────────────────────────────── */
.pop-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFly 0.55s ease-out forwards;
  z-index: 9;
}

@keyframes particleFly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--px), var(--py)) scale(0); opacity: 0; }
}

/* ── INPUT AREA ────────────────────────────────────── */
.game-input-wrap {
  background: var(--bg-card);
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  border-top: 1px solid #e8eaf0;
  flex-shrink: 0;
}

.game-input {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-arena);
  border: 2px solid #dde0ee;
  border-radius: var(--radius-full);
  padding: 0.6rem 1.5rem;
  width: 100%;
  max-width: 480px;
  text-align: center;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  caret-color: var(--accent);
}

.game-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}

.game-input.input-correct {
  border-color: #27ae60;
  box-shadow: 0 0 0 3px rgba(39,174,96,0.18);
}

.game-input.input-wrong {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(231,76,60,0.18);
  animation: inputWiggle 0.25s ease;
}

@keyframes inputWiggle {
  0%, 100% { transform: translateX(0); }
  25%  { transform: translateX(-5px); }
  75%  { transform: translateX(5px); }
}

.input-feedback {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  height: 1em;
  text-align: center;
  transition: color 0.2s;
}

.input-feedback.combo-msg {
  color: var(--accent);
  font-size: 0.85rem;
}

/* ── GAME CONTROLS ─────────────────────────────────── */
.game-controls {
  display: flex;
  justify-content: center;
  padding: 0.4rem 1rem;
  background: var(--bg-card);
  border-top: 1px solid #e8eaf0;
  flex-shrink: 0;
}

.btn-pause {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: transparent;
  border: 1.5px solid #dde0ee;
  border-radius: var(--radius-full);
  padding: 0.3rem 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-pause:hover,
.btn-pause:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

/* ── GAME OVER ─────────────────────────────────────── */
.gameover-section {
  max-width: 500px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  text-align: center;
}

.gameover-inner {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.gameover-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.gameover-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1rem;
  background: var(--bg-arena);
  border-radius: var(--radius-sm);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--accent);
}

.highscore-msg {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: #e6a817;
  min-height: 1.5em;
  letter-spacing: 0.03em;
}

.gameover-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── PAUSE OVERLAY ─────────────────────────────────── */
.pause-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 246, 251, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.pause-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2.5rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.pause-box h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent);
}

.pause-box p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ── FOOTER ────────────────────────────────────────── */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid #e8eaf0;
  padding: 1rem 1.5rem;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-copy {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  gap: 1.25rem;
}

.footer-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-link:hover,
.footer-link:focus-visible {
  color: var(--accent);
  outline: none;
}

/* ── FOCUS VISIBILITY ──────────────────────────────── */
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
}

/* ── LEVEL UP FLASH ────────────────────────────────── */
.levelup-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: levelFlash 0.7s ease forwards;
}

@keyframes levelFlash {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

.levelup-text {
  font-family: var(--font-display);
  font-size: 3.5rem;
  color: var(--accent);
  text-shadow: 0 4px 24px var(--accent-glow);
  letter-spacing: 0.05em;
  padding: 0.5rem 2rem;
  background: rgba(255,255,255,0.85);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

/* ── RESPONSIVE ────────────────────────────────────── */
@media (max-width: 600px) {
  .header-inner { padding: 0.6rem 1rem; }
  .logo-text { font-size: 1.1rem; }
  .nav-link { font-size: 0.82rem; padding: 0.3rem 0.55rem; }

  .game-intro { padding: 2rem 1rem 2.5rem; }
  .game-title { font-size: 2.5rem; }
  .how-to-play { padding: 1.2rem 1.2rem; }

  .game-hud { padding: 0.5rem 1rem; }
  .hud-value { font-size: 1.3rem; }
  .hud-lives { font-size: 1.1rem; }

  .game-input { font-size: 1rem; padding: 0.55rem 1rem; }

  .gameover-inner { padding: 2rem 1.25rem; }
  .gameover-title { font-size: 2rem; }

  .footer-inner { flex-direction: column; gap: 0.5rem; text-align: center; }
  .footer-nav { justify-content: center; }
}

@media (max-width: 400px) {
  .game-title { font-size: 2rem; }
  .difficulty-buttons { gap: 0.4rem; }
  .diff-btn { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
}
