* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: #18191c;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

#game-container {
  width: 100vw;
  max-width: 900px;
  height: 100vh;
  max-height: 1000px;
  background: #23252b;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border-radius: 12px;
  overflow: hidden;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  position: absolute;
  top: 0;
  left: 0;
}

.screen.active {
  display: flex;
}

/* START SCREEN */
#start-screen {
  justify-content: center;
  gap: 30px;
  background: radial-gradient(circle at center, #2e323e 0%, #15171e 100%);
  text-align: center;
}

.logo-img {
  max-width: 140px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
}

h1 {
  font-size: 2.8rem;
  letter-spacing: 2px;
  color: #f5b841;
  text-shadow: 0 4px 8px rgba(0,0,0,0.6);
}

.subtitle {
  font-size: 1.1rem;
  color: #a0a5b5;
  margin-top: 4px;
}

.menu-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 80%;
  max-width: 320px;
}

.btn {
  padding: 14px 24px;
  font-size: 1.1rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: #5cc8c4;
  color: #0f1015;
}

.btn-primary:hover {
  background: #6fe0db;
  box-shadow: 0 6px 16px rgba(92, 200, 196, 0.4);
}

.btn-secondary {
  background: #3a3e4c;
  color: #ffffff;
}

.btn-secondary:hover {
  background: #4a4f61;
}

.btn-danger {
  background: #e74c3c;
  color: #fff;
}

/* TOP STATUS BAR */
.top-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1b1c22;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #323644;
}

.btn-icon {
  background: #3a3e4c;
  border: none;
  color: white;
  font-size: 1.2rem;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.target-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.target-label {
  font-size: 0.9rem;
  font-weight: bold;
  color: #f5b841;
}

.target-box {
  width: 56px;
  height: 56px;
  background: #2a2d38;
  border: 3px solid #f5b841;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(245, 184, 65, 0.3);
}

.target-box img {
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
  object-fit: contain;
}

.stats-pills {
  display: flex;
  gap: 8px;
}

.pill {
  background: #2b2e3a;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: bold;
}

/* BOARD GRID */
.board-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
}

.grid-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 620px;
  aspect-ratio: 7 / 6;
  background: #191a20;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid #353948;
}

.block-cell {
  background: #2b2e3b;
  border-radius: 6px;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, opacity 0.3s;
}

.block-cell:hover {
  border-color: #5cc8c4;
  transform: scale(1.04);
}

.block-cell img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  image-rendering: pixelated;
}

.block-cell.removed {
  opacity: 0.1;
  pointer-events: none;
  background: #15161b;
}

/* TOOLS BAR */
.tools-bar {
  width: 100%;
  background: #1b1c22;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #323644;
  text-align: center;
}

.tools-label {
  font-size: 0.85rem;
  color: #a0a5b5;
  margin-bottom: 8px;
}

.tools-grid {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.tool-btn {
  flex: 1;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #2a2d3a;
  border: 2px solid #3c4154;
  border-radius: 8px;
  padding: 8px 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-btn img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.tool-name {
  font-size: 0.75rem;
  color: #d1d5e0;
}

.tool-btn.selected {
  border-color: #f5b841;
  background: #3e382b;
  box-shadow: 0 0 10px rgba(245, 184, 65, 0.4);
}

/* MODALS */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #282b36;
  border: 2px solid #454b5e;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}

.modal-content h2 {
  color: #f5b841;
  margin-bottom: 16px;
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.victory-card h2 {
  color: #5cc8c4;
}

.fireworks-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.final-stats {
  background: #1b1d24;
  padding: 12px;
  border-radius: 8px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}

.stat-label {
  color: #a0a5b5;
}

.stat-value {
  font-weight: bold;
  color: #ffffff;
}

/* TOAST */
.toast {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(231, 76, 60, 0.95);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  z-index: 50;
  transition: opacity 0.3s;
}

.toast.success {
  background: rgba(46, 204, 113, 0.95);
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
}
