:root {
  /* Сучасна кольорова схема */
  --primary-color: #4e54c8;
  --primary-light: #7377de;
  --primary-dark: #363b8c;
  --background-color: #f8f9fa;
  --card-color: #ffffff;
  --secondary-color: #6c63ff;
  --accent-color: #ff6b6b;
  --interactive-bg: #f0f7ff;
  --text-color: #343a40;
  --text-light: #6c757d;
  --success-color: #00c896;
  --error-color: #ff5252;
  --warning-color: #ffc107;
  --level-color: #8854d0;
  
  /* Інтерфейсні елементи */
  --code-bg: #f7f8fc;
  --border-radius: 12px;
  --button-radius: 8px;
  --card-radius: 16px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --hover-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  --inset-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
  
  /* Типографіка */
  --font-main: 'Roboto', 'Open Sans', sans-serif;
  --font-code: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.7;
  font-family: var(--font-main);
  font-size: 16px;
  letter-spacing: 0.01em;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}

header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  text-align: center;
  padding: 40px 20px;
  border-radius: var(--card-radius);
  margin-bottom: 30px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

header p {
  color: #fff;
}

header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    0deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: rotate(45deg);
  animation: shine 5s infinite linear;
  pointer-events: none;
}

@keyframes shine {
  0% { transform: rotate(45deg) translateX(-100%); }
  100% { transform: rotate(45deg) translateX(100%); }
}

h1 {
  font-size: 42px;
  margin-bottom: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

h2 {
  color: var(--primary-color);
  margin: 25px 0 20px;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 8px;
  font-size: 28px;
  font-weight: 600;
}

h3 {
  font-size: 22px;
  margin-bottom: 15px;
  color: var(--primary-dark);
}

p {
  margin-bottom: 18px;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-color);
}

.interactive {
  background-color: var(--card-color);
  border-radius: var(--card-radius);
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease;
}

.interactive:hover {
  box-shadow: var(--hover-shadow);
}

.game-container {
  display: flex;
  flex-direction: row;
  gap: 25px;
  margin: 25px 0;
  align-items: flex-start;
}

/* Адаптуємо макет для великих рівнів */
@media (max-width: 1100px) {
  .game-container {
    flex-direction: column;
  }
  
  .field-column, 
  .controls-column {
    flex-basis: 100%;
    width: 100%;
  }
  
  .program-textarea {
    min-height: 250px;
  }
  
  .console {
    height: 250px;
  }
}

.game-column {
  flex: 1;
  min-width: 0;
}

.field-column {
  flex-basis: 40%;
}

.controls-column {
  flex-basis: 60%;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* Стилізація відображення рівнів */
.level-progress {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
  justify-content: center;
}

.level-btn {
  padding: 10px 18px;
  background-color: var(--interactive-bg);
  color: var(--text-color);
  border-radius: var(--button-radius);
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease;
  font-weight: 500;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.level-btn.active {
  background-color: var(--level-color);
  color: white;
  font-weight: bold;
  transform: translateY(-2px);
  box-shadow: var(--hover-shadow);
}

.level-btn:hover {
  background-color: var(--primary-light);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--hover-shadow);
}

.level-btn.active:hover {
  background-color: var(--level-color);
}

.level-description {
  padding: 15px;
  background-color: var(--interactive-bg);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
  margin-bottom: 20px;
  font-weight: 500;
}

/* Поле гри */
.robot-field {
  display: grid;
  gap: 4px;
  margin: 20px auto;
  width: max-content;
  background-color: #eaecf4;
  padding: 12px;
  border-radius: var(--border-radius);
  box-shadow: var(--inset-shadow);
}

.cell {
  width: var(--current-cell-size, 50px);
  height: var(--current-cell-size, 50px);
  background-color: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.wall {
  background: linear-gradient(135deg, #8b5e3c, #6b4226);
  border: 1px solid #6b3300;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.2);
}

.cell:hover {
  background-color: var(--interactive-bg);
  transform: translateY(-2px);
}

.robot-icon {
  font-size: calc(var(--current-cell-size, 50px) * 0.64);
  color: var(--primary-color);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.2));
  z-index: 10;
  transition: transform 0.3s ease;
}

.collectible {
  font-size: calc(var(--current-cell-size, 50px) * 0.64);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.2));
  z-index: 5;
  transition: transform 0.3s ease;
}

.collectible:hover {
  transform: scale(1.1) rotate(5deg);
}

/* Редактор програми */
.code-editor {
  background-color: var(--code-bg);
  border-radius: var(--card-radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.program-textarea {
  width: 100%;
  min-height: 300px;
  padding: 20px;
  font-family: var(--font-code);
  font-size: 16px;
  line-height: 1.5;
  border: 2px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--border-radius);
  resize: vertical;
  transition: all 0.3s ease;
  background-color: white;
}

.program-textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(78, 84, 200, 0.1);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.console {
  background-color: #2d2d2d;
  color: #f8f8f8;
  font-family: var(--font-code);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-top: 20px;
  height: 300px;
  overflow-y: auto;
  transition: height 0.3s ease;
  box-shadow: var(--shadow);
}

.console-line {
  margin: 5px 0;
  line-height: 1.4;
  padding: 5px 0;
  border-bottom: 1px solid #444;
}

.console-line:last-child {
  border-bottom: none;
}

.console-error {
  color: var(--error-color);
}

.console-success {
  color: var(--success-color);
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--success-color);
  color: white;
  padding: 15px 30px;
  border-radius: var(--border-radius);
  display: none;
  z-index: 1000;
  font-size: 18px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: toast-appear 0.3s ease;
  align-items: center;
  gap: 12px;
  min-width: 300px;
}

.toast-icon {
  font-size: 24px;
}

.toast-message {
  flex: 1;
}

.emoji-title {
  font-size: 1.1em;
  display: inline-block;
  animation: float 2s ease-in-out infinite;
  margin-left: 5px;
}

@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

@keyframes toast-appear {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

button {
  background: linear-gradient(to right, var(--primary-color), var(--primary-light));
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--button-radius);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 3px 12px rgba(78, 84, 200, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

button:hover {
  background: linear-gradient(to right, var(--primary-dark), var(--primary-color));
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(78, 84, 200, 0.3);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(78, 84, 200, 0.2);
}

footer {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  text-align: center;
  padding: 2.5rem 0;
  border-radius: 20px 20px 0 0;
  margin-top: 4rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, var(--accent-color), var(--success-color), var(--warning-color));
}

footer p {
  font-size: 1.1rem;
  color: white;
  margin-bottom: 0;
}

.step-count {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-weight: bold;
  z-index: 1000;
  box-shadow: var(--shadow);
  transition: background 0.3s ease;
}

.syntax-guide {
  background-color: var(--interactive-bg);
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.syntax-guide pre {
  background-color: white;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  font-family: var(--font-code);
  overflow-x: auto;
  box-shadow: var(--inset-shadow);
  border-left: 3px solid var(--primary-color);
}

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  header {
    padding: 25px 15px;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 24px;
  }

  p {
    font-size: 16px;
  }

  .interactive {
    padding: 20px;
  }

  .game-container {
    flex-direction: column;
  }

  .field-column,
  .controls-column {
    flex-basis: 100%;
    width: 100%;
  }

  /* Встановлюємо менший розмір для всіх клітинок на малих екранах */
  :root {
    --current-cell-size: 40px !important;
  }
  
  .cell {
    width: var(--current-cell-size);
    height: var(--current-cell-size);
  }

  .robot-icon,
  .collectible {
    font-size: calc(var(--current-cell-size) * 0.64);
  }
  
  button {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .controls {
    justify-content: center;
  }
  
  .level-progress {
    gap: 8px;
  }
  
  .level-btn {
    padding: 8px 14px;
    font-size: 14px;
  }
} 
