@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  --night: #050b18;
  --panel: #0a1730;
  --panel-2: #0e2440;
  --cyan: #5de4e7;
  --cyan-soft: #8df7f1;
  --gold: #ffc84b;
  --white: #ecfffb;
  --muted: #84a7b8;
  --danger: #ff5f6d;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--white);
  background:
    radial-gradient(circle at 15% 15%, rgba(0, 216, 230, .12), transparent 25%),
    radial-gradient(circle at 85% 80%, rgba(255, 200, 75, .08), transparent 30%),
    var(--night);
  font-family: Rajdhani, system-ui, sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .13;
  background: repeating-linear-gradient(0deg, transparent 0 3px, #000 3px 4px);
  z-index: 20;
}

.arcade-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding: 4px 6px 18px;
}

h1, h2, p { margin: 0; }

.topbar h1 {
  font: 700 clamp(28px, 4vw, 58px)/.9 Rajdhani, sans-serif;
  letter-spacing: .08em;
}

.topbar h1 span { color: var(--cyan); text-shadow: 0 0 18px rgba(93, 228, 231, .6); }
.topbar p { color: var(--gold); font-weight: 700; letter-spacing: .16em; margin-top: 8px; }

.status {
  display: flex;
  gap: 14px;
  font: 10px/1.5 "Press Start 2P", monospace;
  white-space: nowrap;
}

.status span { color: var(--muted); }
.status strong { display: block; color: var(--white); font-size: 14px; text-align: right; }
.lives-counter { min-width: 76px; }
.life-icons {
  display: block;
  min-height: 15px;
  margin-top: 3px;
  color: var(--cyan);
  font: normal 12px/1 sans-serif;
  letter-spacing: 1px;
  filter: drop-shadow(0 0 5px rgba(93, 228, 231, .65));
}

.level-progress {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  margin: -6px 6px 14px;
}
.progress-label {
  color: var(--muted);
  font: 8px/1 "Press Start 2P", monospace;
  letter-spacing: .08em;
}
.progress-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}
.final-step { color: rgba(255, 200, 75, .76); font-size: 6px; }
.progress-step {
  position: relative;
  z-index: 1;
  height: 15px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(132, 167, 184, .5);
  color: rgba(236, 255, 251, .55);
  background: rgba(10, 23, 48, .92);
  font: 7px/1 "Press Start 2P", monospace;
  transition: background .35s, color .35s, box-shadow .35s, transform .35s;
}
.progress-step.current {
  color: var(--night);
  background: var(--cyan);
  box-shadow: 0 0 13px rgba(93, 228, 231, .6);
  transform: translateY(-1px);
}
.progress-step.completed {
  color: var(--night);
  background: var(--gold);
  border-color: var(--gold);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 72fr) minmax(300px, 28fr);
  gap: 16px;
}

.game-column, .message-panel {
  border: 2px solid rgba(93, 228, 231, .48);
  background: linear-gradient(145deg, rgba(14, 36, 64, .94), rgba(5, 11, 24, .98));
  box-shadow: 0 0 30px rgba(0, 190, 210, .12), inset 0 0 35px rgba(0, 0, 0, .35);
}

.canvas-wrap { position: relative; aspect-ratio: 900 / 650; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

.overlay {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  padding: 30px;
  background: rgba(2, 8, 19, .76);
  backdrop-filter: blur(4px);
}
.overlay.visible { display: grid; }

.overlay-card {
  width: min(560px, 100%);
  text-align: center;
  padding: 42px 28px;
  border: 2px solid var(--cyan);
  background: rgba(8, 23, 44, .96);
  box-shadow: 0 0 28px rgba(93, 228, 231, .24);
}

.overlay-card h2 { font: 18px/1.5 "Press Start 2P", monospace; color: var(--gold); }
.overlay-card p { margin: 18px auto 24px; font-size: 23px; }
.overlay-card small { display: block; margin-top: 22px; color: var(--muted); }
.mini-drop { font-size: 38px; margin-bottom: 16px; }
.brand-logo {
  display: block;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, .13));
}
.brand-logo-intro { height: 54px; max-width: 78%; margin: 0 auto 18px; }
.brand-logo-end { height: 43px; max-width: 68%; margin: 0 auto 24px; }
.development-credit {
  padding-top: 13px;
  border-top: 1px solid rgba(132, 167, 184, .22);
  font-size: 13px;
  line-height: 1.25;
}
.mobile-start-tip { display: none !important; color: var(--cyan-soft) !important; }

.level-overlay { background: rgba(2, 8, 19, .68); }
.level-card {
  width: min(470px, 100%);
  animation: level-in .42s steps(5, end) both;
}
.level-card p {
  color: var(--cyan-soft);
  font: 12px/1.4 "Press Start 2P", monospace;
  letter-spacing: .08em;
  margin-bottom: 9px;
}
.level-card h2 { font-size: clamp(22px, 4vw, 38px); }
.level-check {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  color: var(--night);
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(93, 228, 231, .7), 5px 5px 0 #087f8c;
  font: 30px/1 "Press Start 2P", monospace;
}
.transition-drops {
  margin-top: 22px;
  color: var(--cyan-soft);
  font-size: 22px;
  animation: float 1.2s ease-in-out infinite;
}
.level-card small { margin-top: 13px; }

.final-intro-overlay {
  overflow: hidden;
  background: rgba(1, 4, 13, .87);
}
.final-intro-overlay::before,
.final-intro-overlay::after {
  content: "";
  position: absolute;
  inset: -15%;
  pointer-events: none;
}
.final-intro-overlay::before {
  background: repeating-radial-gradient(circle at center, transparent 0 35px, rgba(255, 95, 109, .12) 37px 40px);
  animation: final-radar 1.2s linear infinite;
}
.final-intro-overlay::after {
  background: linear-gradient(90deg, transparent, rgba(93, 228, 231, .11), transparent);
  animation: final-scan 1.1s linear infinite;
}
.final-intro-card {
  position: relative;
  z-index: 1;
  width: min(590px, 100%);
  padding: 46px 25px;
  text-align: center;
  border: 3px solid var(--danger);
  background: rgba(5, 11, 24, .95);
  box-shadow: 0 0 30px rgba(255, 95, 109, .48), inset 0 0 38px rgba(255, 95, 109, .1);
  animation: final-alert .6s steps(2, end) infinite;
}
.final-intro-card small { color: var(--cyan-soft); font: 10px/1.4 "Press Start 2P", monospace; letter-spacing: .14em; }
.final-intro-card h2 { margin: 18px 0; color: var(--danger); font: clamp(23px, 5vw, 48px)/1.25 "Press Start 2P", monospace; }
.final-intro-card p { color: var(--gold); font: clamp(12px, 2vw, 19px)/1.5 "Press Start 2P", monospace; }
.final-intro-card strong {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin: 27px auto 0;
  color: var(--night);
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(255, 200, 75, .65);
  font: 30px/1 "Press Start 2P", monospace;
}

@keyframes final-radar { to { transform: scale(1.12); opacity: .3; } }
@keyframes final-scan { from { transform: translateX(-60%); } to { transform: translateX(60%); } }
@keyframes final-alert { 50% { border-color: var(--gold); } }

@keyframes level-in {
  from { opacity: 0; transform: scale(.82); }
  to { opacity: 1; transform: scale(1); }
}

button {
  cursor: pointer;
  border: 0;
  color: var(--night);
  background: var(--cyan);
  font: 10px/1 "Press Start 2P", monospace;
  padding: 16px 20px;
  box-shadow: 5px 5px 0 #087f8c;
}
button:hover { transform: translateY(-2px); filter: brightness(1.12); }
.hidden { display: none !important; }
.end-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}
.continue-button {
  color: var(--night);
  background: var(--gold);
  box-shadow: 5px 5px 0 #a86e00;
}

.controls {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 9px 14px;
  color: var(--muted);
  border-top: 1px solid rgba(93, 228, 231, .28);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
}
.touch-controls {
  display: none;
  grid-template-columns: 1fr 1.55fr 1fr .72fr;
  gap: 9px;
  padding: 12px;
  border-top: 1px solid rgba(93, 228, 231, .28);
  background: rgba(5, 11, 24, .96);
}
.touch-button {
  min-height: 58px;
  padding: 8px;
  border: 2px solid rgba(141, 247, 241, .72);
  color: var(--white);
  background: #102944;
  box-shadow: 0 4px 0 #06111f;
  font: 18px/1 "Press Start 2P", monospace;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.touch-button:active,
.touch-button.pressed {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #06111f;
  background: #1b526a;
}
.touch-fire {
  color: var(--night);
  background: var(--cyan);
  font-size: 9px;
}
.touch-pause { color: var(--gold); font-size: 16px; }
.touch-controls p {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
}
kbd { color: var(--white); border: 1px solid #476879; padding: 3px 6px; margin-right: 3px; background: #0c1c31; }
.sound { padding: 8px 10px; font-size: 8px; box-shadow: 3px 3px 0 #087f8c; }
.powerup-status {
  min-width: 128px;
  color: var(--cyan-soft);
  font: 8px/1.2 "Press Start 2P", monospace;
  text-align: center;
}
.powerup-status.active {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 200, 75, .65);
}

.message-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 24px 22px 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(93, 228, 231, .28);
  padding-bottom: 17px;
}
.recycle-mark { font-size: 38px; color: var(--cyan); filter: drop-shadow(0 0 9px rgba(93, 228, 231, .5)); }
.panel-heading small { color: var(--muted); letter-spacing: .15em; }
.panel-heading h2 { color: var(--gold); font-size: 23px; letter-spacing: .06em; }

.translations {
  display: grid;
  align-content: center;
  flex: 1;
  padding: 8px 0;
}

.translation {
  position: relative;
  padding: 10px 8px 10px 42px;
  border-bottom: 1px solid rgba(132, 167, 184, .13);
  color: rgba(236, 255, 251, .7);
  font-size: clamp(14px, 1.18vw, 19px);
  line-height: 1.12;
  font-weight: 600;
  transition: color .4s, background .4s, transform .4s;
}
.translation:last-child { border-bottom: 0; }
.translation b {
  position: absolute;
  left: 7px;
  top: 11px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
}
.translation[dir="rtl"] { padding: 10px 42px 10px 8px; text-align: right; font-family: Arial, sans-serif; }
.translation[dir="rtl"] b { left: auto; right: 7px; }
.translation.active {
  color: var(--white);
  background: linear-gradient(90deg, rgba(93, 228, 231, .14), transparent);
  transform: translateX(4px);
  text-shadow: 0 0 10px rgba(93, 228, 231, .35);
}
.translation.active b { color: var(--gold); }

.panel-footer {
  position: relative;
  text-align: center;
  color: var(--cyan);
  padding-top: 15px;
  border-top: 1px solid rgba(93, 228, 231, .28);
  font-weight: 700;
  letter-spacing: .12em;
}
.brand-logo-sidebar {
  height: 33px;
  max-width: 78%;
  margin: 13px auto 7px;
  opacity: .9;
}
.sidebar-credit {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
  letter-spacing: .03em;
}
.soap-bubble {
  display: inline-block;
  width: 7px; height: 7px;
  margin: 0 4px 8px;
  border: 1px solid var(--cyan-soft);
  border-radius: 50%;
  animation: float 2.4s ease-in-out infinite;
}
.soap-bubble:nth-child(2) { width: 12px; height: 12px; animation-delay: -.7s; }
.soap-bubble:nth-child(3) { width: 5px; height: 5px; animation-delay: -1.2s; }

@keyframes float { 50% { transform: translateY(-6px); opacity: .45; } }

@media (max-width: 980px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .status { width: 100%; justify-content: space-between; }
  .status strong { text-align: left; }
  .game-layout { grid-template-columns: 1fr; }
  .message-panel { min-height: 480px; }
  .translation { font-size: 17px; }
}

@media (hover: none), (pointer: coarse) {
  canvas { touch-action: none; }
  .touch-controls { display: grid; }
  .desktop-control { display: none; }
  .mobile-start-tip { display: block !important; }
}

@media (max-width: 600px) {
  .arcade-shell { padding: 10px; }
  .topbar h1 { font-size: 35px; }
  .status { flex-wrap: wrap; font-size: 8px; gap: 8px 16px; }
  .status > span { min-width: calc(50% - 8px); }
  .status strong { font-size: 11px; }
  .controls { font-size: 11px; }
  .touch-controls { gap: 6px; padding: 9px; }
  .touch-button { min-height: 54px; }
  .touch-fire { font-size: 8px; }

  #startScreen {
    align-items: start;
    padding: 10px;
    overflow: auto;
  }
  #startScreen .overlay-card {
    padding: 13px 10px 15px;
  }
  #startScreen .brand-logo-intro {
    height: 29px;
    max-width: 62%;
    margin: 0 auto 6px;
  }
  #startScreen .mini-drop {
    margin-bottom: 5px;
    font-size: 23px;
  }
  #startScreen .overlay-card h2 {
    font-size: 13px;
    line-height: 1.25;
  }
  #startScreen .overlay-card p {
    margin: 8px auto 11px;
    font-size: 15px;
    line-height: 1.08;
  }
  #startScreen .overlay-card button {
    padding: 13px 11px;
    font-size: 8px;
  }
  #startScreen .overlay-card small {
    margin-top: 10px;
    font-size: 10px;
    line-height: 1.2;
  }
  #startScreen .development-credit { display: none !important; }
}
