* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
  padding: 20px;
  overflow-x: hidden;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

header {
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 4px solid #1976d2;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(25, 118, 210, 0.3));
}

h1 {
  color: #1976d2;
  font-size: 2rem;
}

.stats {
  display: flex;
  gap: 30px;
  font-size: 1.1rem;
  color: #555;
  align-items: center;
}

.stats strong {
  color: #1976d2;
  font-size: 1.3rem;
}

.timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.timer-label {
  font-size: 0.9rem;
  color: #666;
}

.timer {
  font-size: 2rem;
  font-weight: bold;
  color: #1976d2;
  min-width: 80px;
  text-align: center;
  padding: 5px 15px;
  border-radius: 10px;
  background: #e3f2fd;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 2px solid #1976d2;
}

.timer.warning {
  color: #ff6b6b;
  background: #fff3e0;
  border-color: #ff6b6b;
  animation: pulse-warning 1s infinite;
}

.timer.critical {
  color: #ff0000;
  background: #ffebee;
  border-color: #ff0000;
  animation: pulse-critical 0.5s infinite;
}

@keyframes pulse-warning {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes pulse-critical {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.game-area {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
}

.question-section {
  margin-bottom: 30px;
  padding: 20px;
  background: #e3f2fd;
  border-radius: 10px;
  border-left: 5px solid #1976d2;
}

.question-section h2 {
  color: #1976d2;
  margin-bottom: 15px;
  font-size: 1.5rem;
}

#question-text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #333;
  font-weight: 500;
}

.tables-section {
  margin-bottom: 30px;
}

.tables-section h3 {
  color: #1976d2;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

#tables-container {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.table-wrapper {
  flex: 1;
  min-width: 280px;
}

.table-title {
  font-weight: bold;
  color: #1976d2;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.95rem;
  border: 1px solid #e0e0e0;
}

thead {
  background: #1976d2;
  color: white;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

tbody tr:hover {
  background: #f5f5f5;
}

tbody tr:last-child td {
  border-bottom: none;
}

.operation-section h3 {
  color: #1976d2;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

#operations-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
}

.operation-btn {
  padding: 18px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 2px solid #1976d2;
  background: white;
  color: #1976d2;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  line-height: 1.4;
  min-height: 60px;
  display: flex;
  align-items: center;
  word-break: break-word;
}

.operation-btn:hover {
  background: #1976d2;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(25, 118, 210, 0.3);
}

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

.operation-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.result-section {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.result-content {
  background: white;
  padding: 40px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
  position: relative;
  overflow: visible;
  max-width: 600px;
  border-top: 4px solid #1976d2;
}

.result-content.correct {
  animation: slideUp 0.3s ease, pulse 0.6s ease;
}

#result-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 20px;
}

#result-message {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 25px;
  line-height: 1.6;
  word-break: break-word;
}

.btn {
  padding: 12px 30px;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: #1976d2;
  color: white;
}

.btn-primary:hover {
  background: #1565c0;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(25, 118, 210, 0.4);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  padding: 50px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
  max-width: 500px;
  border-top: 4px solid #1976d2;
}

.modal-content h2 {
  color: #1976d2;
  margin-bottom: 20px;
  font-size: 2rem;
}

.modal-content p {
  font-size: 1.2rem;
  color: #333;
  margin-bottom: 15px;
}

.modal-content strong {
  color: #1976d2;
  font-size: 1.5rem;
}

#performance-message {
  color: #666;
  font-style: italic;
  margin-top: 10px;
}

#particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: particle-explosion 1.5s ease-out forwards;
}

.star-particle {
  width: 20px;
  height: 20px;
  background: #1976d2;
  box-shadow: 0 0 10px #1976d2;
}

.circle-particle {
  width: 15px;
  height: 15px;
  background: #42a5f5;
  box-shadow: 0 0 8px #42a5f5;
}

.square-particle {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #64b5f6;
  box-shadow: 0 0 6px #64b5f6;
}

.flash-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(25, 118, 210, 0.2);
  pointer-events: none;
  z-index: 9998;
  animation: flash 0.5s ease-out;
}

.ring-effect {
  position: absolute;
  border: 3px solid #1976d2;
  border-radius: 50%;
  animation: ring-expand 1s ease-out forwards;
  pointer-events: none;
}

@keyframes particle-explosion {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0) rotate(720deg);
    opacity: 0;
  }
}

@keyframes flash {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes ring-expand {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.confetti {
  position: absolute;
  width: 10px;
  height: 30px;
  pointer-events: none;
  animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotateZ(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotateZ(720deg);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 15px;
  }

  .header-content {
    flex-direction: column;
    gap: 10px;
  }

  .logo {
    width: 60px;
    height: 60px;
  }

  h1 {
    font-size: 1.5rem;
    text-align: center;
  }

  .stats {
    flex-direction: column;
    gap: 15px;
  }

  #tables-container {
    flex-direction: column;
  }

  #operations-container {
    grid-template-columns: 1fr;
  }

  .operation-btn {
    font-size: 0.9rem;
    padding: 15px;
  }

  table {
    font-size: 0.85rem;
  }

  th, td {
    padding: 8px;
  }
}
