* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: #263238;
  background: #f5f7f3;
}

h1 {
  margin: 0;
  font-size: 38px;
  font-weight: 700;
  text-align: center;
}

.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 32px 18px;
}

.carousel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 18px;
}

.carousel-button {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: #1f6f68;
  font-size: 44px;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.carousel-button:hover:not(:disabled) {
  background: #174f4b;
  transform: translateY(-1px);
}

.carousel-button:disabled {
  cursor: not-allowed;
  opacity: 0.28;
}

.carousel-viewport {
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 45px rgba(31, 57, 48, 0.16);
}

.carousel-track {
  display: flex;
  transition: transform 420ms ease;
}

.slide-link {
  flex: 0 0 100%;
  display: block;
  color: inherit;
  text-decoration: none;
}

.slide-link img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.slide-link span {
  display: block;
  padding: 18px;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
}

.scene-page {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 28px 18px 44px;
}

.scene-header {
  display: grid;
  grid-template-columns: 90px 1fr 90px;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.back-link {
  justify-self: start;
  color: #1f6f68;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.vocabulary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px;
}

.word-card {
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 25px rgba(31, 57, 48, 0.12);
}

.word-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #e6ece5;
}

.word-card figcaption {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.empty-message {
  text-align: center;
  font-size: 20px;
}

@media (max-width: 700px) {
  h1 {
    font-size: 30px;
  }

  .carousel {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 10px;
  }

  .carousel-button {
    width: 44px;
    height: 44px;
    font-size: 34px;
  }

  .slide-link span {
    padding: 14px;
    font-size: 22px;
  }

  .vocabulary-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 18px;
  }

  .word-card figcaption {
    font-size: 15px;
  }

  .scene-header {
    grid-template-columns: 1fr;
  }

  .back-link {
    justify-self: center;
  }
}
